1、内核更新
2、后台bug修复(获取参数的bug)
This commit is contained in:
2
core/library/think/cache/driver/File.php
vendored
2
core/library/think/cache/driver/File.php
vendored
@@ -101,7 +101,7 @@ class File
|
||||
$content = file_get_contents($filename);
|
||||
if (false !== $content) {
|
||||
$expire = (int) substr($content, 8, 12);
|
||||
if (0 != $expire && time() > filemtime($filename) + $expire) {
|
||||
if (0 != $expire && $_SERVER['REQUEST_TIME'] > filemtime($filename) + $expire) {
|
||||
//缓存过期删除缓存文件
|
||||
$this->unlink($filename);
|
||||
return false;
|
||||
|
||||
4
core/library/think/cache/driver/Lite.php
vendored
4
core/library/think/cache/driver/Lite.php
vendored
@@ -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;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ class Memcached
|
||||
'expire' => 0,
|
||||
'timeout' => 0, // 超时时间(单位:毫秒)
|
||||
'prefix' => '',
|
||||
'username' => '', //账号
|
||||
'password' => '', //密码
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -55,6 +57,10 @@ class Memcached
|
||||
$servers[] = [$host, (isset($ports[$i]) ? $ports[$i] : $ports[0]), 1];
|
||||
}
|
||||
$this->handler->addServers($servers);
|
||||
if('' != $this->options['username']){
|
||||
$this->handler->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
|
||||
$this->handler->setSaslAuthData($this->options['username'], $this->options['password']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +88,7 @@ class Memcached
|
||||
$expire = $this->options['expire'];
|
||||
}
|
||||
$name = $this->options['prefix'] . $name;
|
||||
$expire = 0 == $expire ? 0 : time() + $expire;
|
||||
$expire = 0 == $expire ? 0 : $_SERVER['REQUEST_TIME'] + $expire;
|
||||
if ($this->handler->set($name, $value, $expire)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
4
core/library/think/cache/driver/Sqlite.php
vendored
4
core/library/think/cache/driver/Sqlite.php
vendored
@@ -56,7 +56,7 @@ class Sqlite implements CacheInterface
|
||||
public function get($name)
|
||||
{
|
||||
$name = $this->options['prefix'] . sqlite_escape_string($name);
|
||||
$sql = 'SELECT value FROM ' . $this->options['table'] . ' WHERE var=\'' . $name . '\' AND (expire=0 OR expire >' . time() . ') LIMIT 1';
|
||||
$sql = 'SELECT value FROM ' . $this->options['table'] . ' WHERE var=\'' . $name . '\' AND (expire=0 OR expire >' . $_SERVER['REQUEST_TIME'] . ') LIMIT 1';
|
||||
$result = sqlite_query($this->handler, $sql);
|
||||
if (sqlite_num_rows($result)) {
|
||||
$content = sqlite_fetch_single($result);
|
||||
@@ -84,7 +84,7 @@ class Sqlite implements CacheInterface
|
||||
if (is_null($expire)) {
|
||||
$expire = $this->options['expire'];
|
||||
}
|
||||
$expire = (0 == $expire) ? 0 : (time() + $expire); //缓存有效期为0表示永久缓存
|
||||
$expire = (0 == $expire) ? 0 : ($_SERVER['REQUEST_TIME'] + $expire); //缓存有效期为0表示永久缓存
|
||||
if (function_exists('gzcompress')) {
|
||||
//数据压缩
|
||||
$value = gzcompress($value, 3);
|
||||
|
||||
Reference in New Issue
Block a user