1. What is a session?
The equivalent of a client (can be browser, app, FTP and other, and the same browser open a few more different client) to a server access, this period of time the server to establish a unique identifier (session_id session_name), The session is actually an array of arrays (), the beginning and end of thesession does not start with the business input username password, and does not close the browser and page refresh and the session ends
2.session Destruction of variables
<?phpsession_unset (); Session_destroy ();? >
Session_unset ()//Releases all $_session variables that are currently created in memory, but does not delete the session file and does not release the corresponding session ID
Session_destroy ()//delete the current user's session file and release session ID, the contents of the $_session variable in memory remain
"Note":
To delete the session method:
1, unset ($_session[' xxx ']) delete a single session,unset ($_session[' xxx ') to unregister a registered SESSION variable. Its effect is the same as Session_unregister (). Session_unregister () is no longer used in PHP5 and can be limbo.
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 more than one SESSION
3. 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 (GlobalVariables), nor does it delete the client's session cookie. PHP's default session is cookie-based, and if you want to delete a cookie, you must use the Setcookie () function.
Return value: A Boolean value.
Function Description: This function ends the current session, this function has no parameters and the return value is True
Session_unset () If $_session is used, the function no longer works. Since PHP5 is bound to use $_session, this function can be limbo.
The steps to delete the session can be drawn:
①session_start ()
②$_session=array ()/unset ($_session[' xxx ')
③session_destroy ()
Related recommendations:
Correct logoff of PHP SESSION, logoff phpsession_php tutorial
PHP use the session to prevent page repeat refresh, phpsession prevent page _php tutorial
PHP through the session anti-URL attack method, phpsession anti-url_php tutorial