PHP mock ASP Application object online population statistics _php Tutorial

Source: Internet
Author: User
PHP Tutorial Imitate ASP Tutorial Application object Online population statistics

Usage:
Application (' key ', ' value '); Set Key=value
$value = Application (' key '); Get the value of key
*/

function Application ()
{
$args = Func_get_args (); Get input parameters
if (count ($args) >2 | | count ($ARGS) < 1) return;
$ssid = session_id (); Save current session_id
Session_write_close (); End Current session
Ob_start (); Disable Global Session Send header
session_id ("xxx"); Registering a global session_id
Session_Start (); Turn on global session
$key = $args [0];
if (count ($args) = = 2)//If there is a second argument, then the global session is written
{
$re = ($_session[$key] = $args [1]);
}
else//If there is only one argument, return the value corresponding to the parameter
{
$re = $_session[$key];
}
Session_write_close (); End Global Session
session_id ($SSID); Re-registering a non-global session that was interrupted above
Session_Start (); Re-open
Ob_end_clean (); Discard some header output just because of session_start
return $re;
}


http://www.bkjia.com/PHPjc/444858.html www.bkjia.com true http://www.bkjia.com/PHPjc/444858.html techarticle PHP Tutorial Imitate ASP Tutorial Application object Online Demographics Usage: application (' key ', ' value '),//set Key=value $value = Application (' key ');//Get Value of key */function AP ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.