📜  离开页面后的 php - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:02.357000             🧑  作者: Mango

代码示例1
$_SESSION['previous'] = basename($_SERVER['PHP_SELF']);

if (isset($_SESSION['previous'])) {
   if (basename($_SERVER['PHP_SELF']) != $_SESSION['previous']) {
        session_destroy();
        ### or alternatively, you can use this for specific variables:
        ### unset($_SESSION['varname']);
   }
}