下面是我的php网站中的链接..点击此按钮后,用户的会话应该终止并进入登录页面。
但会议没有到期。
<?php
$logoutGoTo = "../index.php";
if (!isset($_SESSION)) {
session_start();
}
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
if ($logoutGoTo != "") {header("Location: $logoutGoTo");
exit;
}
?>
答案 0 :(得分:2)
使用此功能
session_destroy();
答案 1 :(得分:-1)
注销不应该只是转到index.php,请让它转到注销页面:你已经应用了Dreamweaver注销服务器行为,它包含一行代码
`session_destroy(); or unset($_SESSION);`
Your index.php should also be able to regenerate_id();
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
我想,希望这会有所帮助。