tougao/admin/logout.php
2025-05-26 15:23:18 +08:00

22 lines
449 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
session_start();
// 清除所有会话数据
$_SESSION = array();
// 如果使用了cookie也删除它
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();
// 重定向到登录页面
header('Location: login.php');
exit;
?>