我正在寻找已完成一半的答案的解决方案我必须让用户从我的网站注销,我使用了您的解决方案,如下所示:-
if( $_SESSION['last_activity'] < time()-$_SESSION['expire_time'] ) {
//have we expired?
//redirect to logout.php
header('Location: '.BASE_FULL_PATH.'/user/logout'); //change yoursite.com to the name of you site!!
} else{ //if we haven't expired:
$_SESSION['last_activity'] = time(); //this was the moment of last activity.
}
$_SESSION['logged_in'] = true;
$_SESSION['last_activity'] = time();
$_SESSION['expire_time'] = 24*60*60;
它工作得很好,但是当会话即将到期时我需要一个警告框。尝试很多东西但没有帮助。请回复并感谢您的精彩演示