我有一个在线系统,需要用户闲置60分钟后注销。从时间删除一个小时()
现在,当前的代码可以计算出什么时间少了30分钟。
$cut = time() - 30*60;
现在我会想,以下将删除一个小时,所以超时是60分钟。
$cut = time() - 60*60;
这是发生的完整代码。在不活动60分钟后,我需要该人员注销。
// Time out Users 60 minutes
$last = $_SESSION['time'];
$cut = time() - 60*60;
if ($last < $cut)
{
session_destroy();
$get = $_GET;
$location = 'login.php?timeout=true';
foreach($get as $key => $item)
{
$location .= '&'.$key."=".$item;
}
header('Location: '.$location);
}
else
$_SESSION['time'] = time();
现在,代码不起作用,我不认为。
Mayby这可以帮助你如何设置会话的生命周期! http://stackoverflow.com/q/6360093/3933332 – Rizier123 2014-10-10 13:10:03
你需要该人被注销(即:会议被销毁)。你需要'?timeout = true'吗?如果没有,请将最大会话生存期设置为3600 - http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime – 2014-10-10 13:10:05
我认为您需要了解会话处理程序类。 http://php.net/manual/en/sessionhandler.destroy.php – Naeem 2014-10-10 13:11:20