1 回答

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超11個(gè)贊
我想我發(fā)現(xiàn)了問(wèn)題。
取消設(shè)置并銷毀會(huì)話后。我不得不開(kāi)始一個(gè)新的會(huì)話。
奇怪的是,這種情況每秒鐘才發(fā)生一次。但是添加session_start();解決了問(wèn)題!
if(isset($_SESSION['last_action'])){
$secondsInactive = time() - $_SESSION['last_action'];
$expireAfterSeconds = $expireAfter * 60;
$debug.="last action: $secondsInactive seconds ago<br>";
if($secondsInactive >= $expireAfterSeconds){
//User has been inactive for too long.
//Kill their session.
session_unset();
session_destroy();
$debug.="session destroy for inactivity<br>";
}
}
...
session_start();
$_SESSION['user'] = $session_data;
...
- 1 回答
- 0 關(guān)注
- 117 瀏覽
添加回答
舉報(bào)