修正cache方法的变量规则检查位置

This commit is contained in:
thinkphp
2016-09-24 22:17:46 +08:00
parent ba85658c58
commit 10db21a084

View File

@@ -1464,7 +1464,6 @@ class Request
*/ */
public function cache($key, $expire = null) public function cache($key, $expire = null)
{ {
if (Cache::has($key)) {
if (false !== strpos($key, ':')) { if (false !== strpos($key, ':')) {
$param = $this->param(); $param = $this->param();
foreach ($param as $item => $val) { foreach ($param as $item => $val) {
@@ -1473,6 +1472,7 @@ class Request
} }
} }
} }
if (Cache::has($key)) {
// 读取缓存 // 读取缓存
$content = Cache::get($key); $content = Cache::get($key);
$response = Response::create($content)->header('Content-Type', Cache::get($key . '_header')); $response = Response::create($content)->header('Content-Type', Cache::get($key . '_header'));