【发布时间】:2017-01-14 02:15:38
【问题描述】:
我在 survey.php 文件的开头写了这段代码:
<?php
//Check if session set
if (session_status() == PHP_SESSION_NONE)
session_start();
//Check if un user login or no
if (isset($_SESSION['user'])){
//check if the user is admin
if($_SESSION['type']==1)
header( 'Location: admin.php');
}
// check if no user login
else
//Go to first page
header( 'Location: index.php');
//Check if thimeout is finished.
if( $_SESSION['last_activity'] < time()-$_SESSION['expire_time'] ) {
session_unset();
session_destroy();
//Go to first page
header('Location: index.php');
}
else{
$_SESSION['last_activity'] = time();
}
?>
我把 cmets 放在里面了。
在完成进入 index.php 页面的超时后,网站变得非常缓慢,然后进入 index.php
但如果我通过 google chrome 清理 cookie,它会变得像以前一样快。
【问题讨论】:
标签: php google-chrome session timeout