<?php
session_start();

// 1. 销毁 Session
$_SESSION = array();
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();

// 2. 清除持久化 Cookie (关键步骤)
// 将过期时间设为过去的时间，浏览器会自动删除
setcookie('remember_me_token', '', time() - 3600, '/');

// 3. 跳转
header('Location: index.php');
exit;
?>
