From 677a73938c8e6960d22c11272e34fb23ab5a5e9d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 19 Apr 2016 17:06:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 4aa4c4e5..a5df413a 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -853,11 +853,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess if (!isset(self::$links[$model])) { self::$links[$model] = Db::connect(static::$connection); - self::$links[$model]->setTable(static::$tableName); - $name = basename(str_replace('\\', '/', $model)); - self::$links[$model]->name($name); } - + self::$links[$model]->setTable(static::$tableName); + $name = basename(str_replace('\\', '/', $model)); + self::$links[$model]->name($name); // 设置当前模型 确保查询返回模型对象 self::$links[$model]->model($model); // 返回当前数据库对象