From 15516a102acfafd08b9e2172ad1c912ce8d090c8 Mon Sep 17 00:00:00 2001 From: ThinkPHP Date: Thu, 18 Apr 2013 10:20:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Loader=E7=B1=BB=E7=9A=84table?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Think/Loader.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Library/Think/Loader.php b/Library/Think/Loader.php index fea30b83..786cb199 100644 --- a/Library/Think/Loader.php +++ b/Library/Think/Loader.php @@ -102,22 +102,21 @@ class Loader { } /** - * 实例化一个没有模型文件的Model + * 实例化一个没有模型文件的Model(对应数据表) * @param string $name Model名称 支持指定基础模型 例如 MongoModel:User - * @param string $tablePrefix 表前缀 - * @param mixed $connection 数据库连接信息 + * @param array $options 模型参数 * @return Model */ - static public function table($name = '', $tablePrefix = '',$connection = '') { + static public function table($name = '', $options=[]) { static $_model = []; if(strpos($name, ':')) { list($class, $name) = explode(':', $name); }else{ $class = 'Think\Model'; } - $guid = $tablePrefix . $name . '_' . $class; + $guid = $name . '_' . $class; if (!isset($_model[$guid])) - $_model[$guid] = new $class($name, ['table_prefix' => $tablePrefix, 'connection' => $connection]); + $_model[$guid] = new $class($name, $options); return $_model[$guid]; }