From 10db21a0848852c96cb218ba078269366e289c90 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 24 Sep 2016 22:17:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3cache=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E7=9A=84=E5=8F=98=E9=87=8F=E8=A7=84=E5=88=99=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Request.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/library/think/Request.php b/library/think/Request.php index c0ab36d2..a7b50ba8 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -1464,15 +1464,15 @@ class Request */ public function cache($key, $expire = null) { - if (Cache::has($key)) { - if (false !== strpos($key, ':')) { - $param = $this->param(); - foreach ($param as $item => $val) { - if (is_string($val) && false !== strpos($key, ':' . $item)) { - $key = str_replace(':' . $item, $val, $key); - } + if (false !== strpos($key, ':')) { + $param = $this->param(); + foreach ($param as $item => $val) { + if (is_string($val) && false !== strpos($key, ':' . $item)) { + $key = str_replace(':' . $item, $val, $key); } } + } + if (Cache::has($key)) { // 读取缓存 $content = Cache::get($key); $response = Response::create($content)->header('Content-Type', Cache::get($key . '_header'));