复制代码 代码如下:
#*******************************************
#作用:页面无操作,自动过期函数
#参数:$onlinetime 当前页面最后一次使用时间
#参数:$interval 页面超时时间
#返回:无
#*******************************************
function user_mktime($onlinetime,$interval){
$new_time = mktime();
if($new_time-$onlinetime > $interval){
echo "登录超时!";
session_destroy();
exit();
}else{
$_SESSION[times] = mktime();
}
}
user_mktime($_SESSION[times],3600) //1小时不使用,当前页面自动过期
?>
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn