&ajax=检查会话的有效性时,在查询字符串中添加(任何内容)。
然后,更改您的PHP会话代码:
session_start();if(!isset($_GET["ajax"])) $_SESSION["lastactivity"] = time();if(now() - $_SESSION["lastactivity"] > 3600){ //3600 seconds header("Location: login.php?url="+urlenpre(str_replace("&ajax=", "", $_SERVER["REQUEST_URI"]))); //Example: // Location: login.php?url=/sensible/secret.php?mode=show&hide=nothing exit;}


