Skip to content

Instantly share code, notes, and snippets.

@trevorgreenleaf
Created July 9, 2013 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trevorgreenleaf/5959008 to your computer and use it in GitHub Desktop.
Save trevorgreenleaf/5959008 to your computer and use it in GitHub Desktop.
Session
foreach($_SESSION as $key => $value)
{
unset($_SESSION[$key]);
}
// 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"]
);
}
session_destroy();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment