From 0fd725967906a97743e2574de5e7e2573dd31544 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 26 Dec 2016 23:06:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Connection.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index 3ab285dc..7392cc1d 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -137,11 +137,11 @@ abstract class Connection * @param string $queryClass 查询对象类名 * @return Query */ - public function model($model, $queryClass = '') + public function model($model = 'db', $queryClass = '') { if (!isset($this->query[$model])) { $class = $queryClass ?: $this->config['query']; - $this->query[$model] = new $class($this, $model); + $this->query[$model] = new $class($this, 'db' == $model ? '' : $model); } return $this->query[$model]; } @@ -155,8 +155,7 @@ abstract class Connection */ public function __call($method, $args) { - $query = $this->model('datebase'); - return call_user_func_array([$query, $method], $args); + return call_user_func_array([$this->model(), $method], $args); } /**