From 6a550b8cb8db09e98bcf57cca5a00689171003a1 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 15 May 2017 16:45:20 +0800 Subject: [PATCH] =?UTF-8?q?Query=E7=B1=BB=E5=88=86=E9=A1=B5=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=96=B9=E6=B3=95=E5=A2=9E=E5=8A=A0total=5Fcache?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index d9cc56a5..d24943fe 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -1336,7 +1336,8 @@ class Query unset($this->options['order'], $this->options['limit'], $this->options['page'], $this->options['field']); $bind = $this->bind; - $total = $this->count(); + $cache = !empty($config['total_cache']) ? $config['total_cache'] : false; + $total = $this->cache($cache)->count(); $results = $this->options($options)->bind($bind)->page($page, $listRows)->select(); } elseif ($simple) { $results = $this->limit(($page - 1) * $listRows, $listRows + 1)->select();