PHP session tracking and File Processing System (43 ),
Cancel variable
1. unset ($ _ SESSION ['xxx']) deletes a single session variable. unset ($ _ SESSION ['xxx']) is used to unregister a registered session variable. It works the same as session_unregister. Session_unregister () is no longer used in PHP5.
Note: The unset ($ _ SESSION) function is never available. It destroys the global variable $ _ SESSION and there is no feasible way to restore it. You can no longer register the $ _ SESSION variable.
2. $ _ SESSION = array () delete Multiple session Variables
3. session_unset () deletes all session variables.
Destroy session
Session_destroy () ends the current session and clears all resources in the session. This function does not unset (release) global variables related to the current session, nor delete the client session cookie.
Return Value: Boolean value.
Function Description: This function ends the current session.
No parameter, and the return value is true,
Note: The default session in PHP is based on cookies. to delete a cookie, you must use the setcookie () function.
Delete a session
<? Php // initialize session. session_start ();/* Delete all session variables .. You can also delete unset ($ _ SESSION ['xxx']) one by one. */$ _ SESSION = array (); // or session_unset ();/* Delete sessinid. because the session is cookie-based by default, setcookie is used to delete the cookie containing the session id. */if (isset ($ _ COOKIE [session_name ()]) {setcookie (session_name (), '', time ()-42000 ,'/');} // Finally, the session is completely destroyed. session_destroy ();?>
Persistent session
After the request ends, all the registered variables will be automatically serialized (to facilitate the storage to the session text file on the server side) and restored upon reading.