From d8c25a7970f74bb13e14223c5ae117d12d7094c1 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 25 Oct 2016 23:15:41 +0800 Subject: [PATCH] =?UTF-8?q?cache=E5=8A=A9=E6=89=8B=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20remember=E6=96=B9=E6=B3=95=20=EF=BC=8C?= =?UTF-8?q?=E7=94=A8=E6=B3=95=E4=B8=BA=EF=BC=9A=20cache('=3Fname',function?= =?UTF-8?q?(){=20=20=20=20return=20'value';=20});=20=E6=88=96=E8=80=85=20c?= =?UTF-8?q?ache('=3Fname','value);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helper.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/helper.php b/helper.php index bcb52ea3..e0cc719e 100644 --- a/helper.php +++ b/helper.php @@ -365,6 +365,9 @@ if (!function_exists('cache')) { } elseif (is_null($value)) { // 删除缓存 return Cache::rm($name); + } elseif (0 === strpos($name, '?') && '' !== $value) { + $expire = is_numeric($options) ? $options : null; + return Cache::remember(substr($name, 1), $value, $expire); } else { // 缓存数据 if (is_array($options)) {