读书人

PHP logout效能

发布时间: 2013-07-09 09:50:48 作者: rapoo

PHP logout功能
<?phpsession_start();echo var_dump($_SESSION);session_destroy();echo var_dump($_SESSION);session_start();echo var_dump($_SESSION);?>

?结果是

array(4) { ["username"]=> string(2) "xx" ["user_id"]=> string(1) "7" ["user_level"]=> string(1) "0" ["signed_in"]=> bool(true) }array(4) { ["username"]=> string(2) "xx" ["user_id"]=> string(1) "7" ["user_level"]=> string(1) "0" ["signed_in"]=> bool(true) }array(0) { } 

?

<?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();?>

?

读书人网 >PHP

热点推荐