PHP session tracking End and file processing System one (_php), tutorial

Source: Internet
Author: User
Tags session id php session setcookie

PHP session tracking End and file processing system one (43),


Unregister variables

1, unset ($_session[' xxx ']) Delete a single session variable, unset ($_session[' xxx ") is used to unregister a registered session variable.     Its effect is the same as Session_unregister (). Session_unregister () is no longer used in PHP5.
Note: unset ($_session) This function must not be used, it will destroy the global variable $_session, and there is no viable way to restore it. Users can no longer register $_session variables.
2. $_session=array () delete multiple SESSION variables
3, Session_unset () Delete all session variables

Destroying sessions

Session_destroy () ends the current session and empties all resources in the session. The function does not unset (releases) the global variables associated with the current session, nor does it delete the client's session cookie.
Return value: A Boolean value.
Function Description: This function ends the current session, this function
There are no parameters, and the return value is true.

Note: PHP's default session is cookie-based, and if you want to delete cookies, you must use the Setcookie () function.

Delete a session case

? PHP // initializes the session. session_start (); /* Delete all the session variables: unset ($_session[' xxx ') can also be deleted individually.  */= Array (); // or Session_unset (); /* Delete Sessinid. Because the session is cookie-based by default, use Setcookie to delete the cookie that contains the session ID. */ if  ", Time ()-42000,'/' );} // Finally, the session is completely destroyed. Session_destroy ();? >

Persistent session

All registered variables are automatically serialized at the end of the request (for easy saving to the server-side session text file) and then restored when read.

http://www.bkjia.com/PHPjc/1012252.html www.bkjia.com true http://www.bkjia.com/PHPjc/1012252.html techarticle PHP Session trace with file processing System One (43), unregister variable 1, unset ($_session[xxx]) Delete a single session variable, unset ($_session[xxx]) is used to unregister a registered SES ...

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