PHP imitate ASP Application object online population statistic realization method, Application Object _php Tutorial

Source: Internet
Author: User
Tags php programming

PHP imitate ASP Application object online population statistic realization method, Application Object


In this paper, we describe the method of PHP imitating ASP Application object online population statistic. Share to everyone for your reference. The implementation method is as follows:

Copy the Code Code as follows:/*
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;
}

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/937086.html www.bkjia.com true http://www.bkjia.com/PHPjc/937086.html techarticle PHP imitate ASP Application object online population statistic realization method, Application object This article narrates PHP to imitate ASP Application object online population statistic realization method. To share with you ...

  • Related Article

    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.