New in PHP 5.4 adds to the effectiveness of session state judgment

Source: Internet
Author: User
New in PHP 5.4 adds the ability to judge the session state
In previous versions of PHP, to determine if the session is valid, you can use the following method:
Session_Start ();    if (Isset ($_session))  {     echo "Started";  }  else  {    echo "not Started";  }


In PHP 5.4 (coming soon), the status of the session is subdivided, which can be judged by the following methods:
Session_Start ();    $status = Session_status ();    if ($status = = php_session_disabled)  {    echo "SESSION is DISABLED";  }  else if ($status = = Php_session_none)  {    echo "session Enabled but No SESSION values Created";  }  else  {    echo "session Enabled and Session values Created";  }


You can see that by using Session_status (), a value of type int is returned, indicating the various states of the session, such as prohibitions (php_session_disabled), the session does not exist
(Php_session_none)
, or the SESSION has been set up (php_session_active)

1/F Lijichao 2012-02-20

2/F mailangel123 2012-02-21

This can have.

3/F mailangel123 2012-02-21

[Color=red] [/color] [/align] [/size][align=center]

[/align] [Align=right]

[Size=x-small]

[Align=left] [/align]

  • 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.