angelitoestebancito at gmail dot com 16-Aug-2008 09:41 If you create a logout.php to end user session, do not forget to start the session in this page!, using session_start() at the very begging of your script. Thus,session_start(); session_unset(); session_destroy();will be the right sequence to end a user's session. This is a very basic concept, but took me a while to realize I was forgetting to start the session.from:http://hk.php.net/manual/en/function.session-unset.php
session_destroy();
$_SESSION = array();
session_destroy();
<a href="logout.php?key=out" target="_top">退出</a>logout.php<?php
if($_GET['key'] == "out"){
unset($_SESSION['这里是你登录时候设置的SESSION']);
echo "<script>alert('退出成功!');location.href='login.php'";
}
?>
unset($_SESSION["name"]);session_destroy();
session_unset();
session_destroy();
header('Location: index.php');
exit();
session_destroy(); //销毁session
$_SESSION = array(); //把session变量设置为空数组
If you create a logout.php to end user session, do not forget to start the session in this page!, using session_start() at the very begging of your script. Thus,session_start();
session_unset();
session_destroy();will be the right sequence to end a user's session.
This is a very basic concept, but took me a while to realize I was forgetting to start the session.from:http://hk.php.net/manual/en/function.session-unset.php