From c67eb5adc87596772cb5a1e6632c01e49d24f6e8 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 10 Oct 2016 17:25:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BQuery=E7=B1=BB=E7=9A=84value?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=BC=93=E5=AD=98=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index 79ad05ba..5c3e0f0e 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -377,7 +377,7 @@ class Query */ public function value($field, $default = null) { - $result = null; + $result = false; if (!empty($this->options['cache'])) { // 判断查询缓存 $cache = $this->options['cache']; @@ -387,7 +387,7 @@ class Query $key = is_string($cache['key']) ? $cache['key'] : md5($field . serialize($this->options)); $result = Cache::get($key); } - if (!$result) { + if (false === $result) { if (isset($this->options['field'])) { unset($this->options['field']); } @@ -409,7 +409,7 @@ class Query // 清空查询条件 $this->options = []; } - return !is_null($result) ? $result : $default; + return false !== $result ? $result : $default; } /** @@ -431,7 +431,7 @@ class Query $guid = is_string($cache['key']) ? $cache['key'] : md5($field . serialize($this->options)); $result = Cache::get($guid); } - if (!$result) { + if (false === $result) { if (isset($this->options['field'])) { unset($this->options['field']); }