From 65f6ee1fcf05983aeaa3748f8da8496c4b85b1b1 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 8 Apr 2016 17:32:35 +0800 Subject: [PATCH] =?UTF-8?q?Driver=E7=B1=BB=E7=9A=84get=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=9B=B4=E5=90=8D=E4=B8=BAvalue=E6=96=B9=E6=B3=95=20=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E5=92=8Cmodel=E7=B1=BB=E7=9A=84get=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=B7=B7=E6=B7=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Driver.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/library/think/db/Driver.php b/library/think/db/Driver.php index 94516c8b..1f030169 100644 --- a/library/think/db/Driver.php +++ b/library/think/db/Driver.php @@ -131,7 +131,7 @@ abstract class Driver // 根据某个字段获取记录的某个值 $name = Loader::parseName(substr($method, 10)); $where[$name] = $args[0]; - return $this->where($where)->get($args[1]); + return $this->where($where)->value($args[1]); } elseif (isset($this->scope[$method])) { // 命名范围的单独调用支持 return $this->scope($method, $args[0]); @@ -1008,7 +1008,7 @@ abstract class Driver * @param bool $resultSet 是否需要返回字段列表 * @return mixed */ - public function get($field, $resultSet = false) + public function value($field, $resultSet = false) { // 返回数据个数 if (!$resultSet) { @@ -1044,7 +1044,7 @@ abstract class Driver */ public function count($field = '*') { - return $this->get('COUNT(' . $field . ') AS tp_count'); + return $this->value('COUNT(' . $field . ') AS tp_count'); } /** @@ -1055,7 +1055,7 @@ abstract class Driver */ public function sum($field = '*') { - return $this->get('SUM(' . $field . ') AS tp_sum'); + return $this->value('SUM(' . $field . ') AS tp_sum'); } /** @@ -1066,7 +1066,7 @@ abstract class Driver */ public function min($field = '*') { - return $this->get('MIN(' . $field . ') AS tp_min'); + return $this->value('MIN(' . $field . ') AS tp_min'); } /** @@ -1077,7 +1077,7 @@ abstract class Driver */ public function max($field = '*') { - return $this->get('MAX(' . $field . ') AS tp_max'); + return $this->value('MAX(' . $field . ') AS tp_max'); } /** @@ -1088,7 +1088,7 @@ abstract class Driver */ public function avg($field = '*') { - return $this->get('AVG(' . $field . ') AS tp_avg'); + return $this->value('AVG(' . $field . ') AS tp_avg'); } /**