Home > php教程 > php手册 > PHP自定义函数收代码

PHP自定义函数收代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:15:01
Original
1074 people have browsed it

复制代码 代码如下:


#*******************************************
#作用:页面无操作,自动过期函数
#参数:$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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template