Query: session_destroy
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
SESSION_DESTROY(3) 1 SESSION_DESTROY(3) session_destroy - Destroys all data registered to a sessionSYNOPSISbool session_destroy (void )DESCRIPTIONsession_destroy(3) destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. To use the session variables again, session_start(3) has to be called. In order to kill the session altogether, like to log the user out, the session id must also be unset. If a cookie is used to propagate the session id (default behavior), then the session cookie must be deleted. setcookie(3) may be used for that.RETURN VALUESReturns TRUE on success or FALSE on failure.EXAMPLESExample #1 Destroying a session with $_SESSION <?php // Initialize the session. // If you are using session_name("something"), don't forget it now! session_start(); // Unset all of the session variables. $_SESSION = array(); // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } // Finally, destroy the session. session_destroy(); ?>NOTESNote Only use session_unset(3) for older deprecated code that does not use $_SESSION.SEE ALSOunset(3), setcookie(3). PHP Documentation Group SESSION_DESTROY(3)
Related Man Pages |
---|
session_regenerate_id(3) - php |
session_destroy(3) - php |
session_register(3) - php |
session_start(3) - php |
sessionhandlerinterface.read(3) - php |
Similar Topics in the Unix Linux Community |
---|
tracing a user's session |
session limit in php |
Logoff a user... |
kill user session |
Telnet session timed out after some time (2-3 min) if session is idle |