替换 time() 为 $_SERVER['REQUEST_TIME']

This commit is contained in:
thinkphp
2016-07-03 15:03:10 +08:00
parent a322a28f27
commit ea9682c724
8 changed files with 13 additions and 13 deletions

View File

@@ -65,7 +65,7 @@ class Lite
if (is_file($filename)) {
// 判断是否过期
$mtime = filemtime($filename);
if ($mtime < time()) {
if ($mtime < $_SERVER['REQUEST_TIME']) {
// 清除已经过期的文件
unlink($filename);
return false;
@@ -97,7 +97,7 @@ class Lite
$ret = file_put_contents($filename, ("<?php return " . var_export($value, true) . ";"));
// 通过设置修改时间实现有效期
if ($ret) {
touch($filename, time() + $expire);
touch($filename, $_SERVER['REQUEST_TIME'] + $expire);
}
return $ret;
}