From 9e44381f6f8977479387e7da53426d65329be19b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 25 Feb 2015 10:50:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=95=B0=E6=8D=AE=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E5=89=8D=E7=BC=80=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base.php | 2 +- library/think/model.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/base.php b/base.php index c72365eb..e7580972 100644 --- a/base.php +++ b/base.php @@ -90,7 +90,7 @@ function G($start,$end='',$dec=6) { * @return Model */ function M($name='', $tablePrefix='',$connection='') { - return think\Loader::table($name,['table_prefix'=>$tablePrefix,'connection'=>$connection]); + return think\Loader::table($name,['prefix'=>$tablePrefix,'connection'=>$connection]); } /** diff --git a/library/think/model.php b/library/think/model.php index 833b937c..f55a0ff5 100644 --- a/library/think/model.php +++ b/library/think/model.php @@ -69,6 +69,8 @@ class Model { if(isset($config['prefix'])) { $this->tablePrefix = $config['prefix']; + }else{ + $this->tablePrefix = Config::get('database.prefix'); } if(isset($config['connection'])) { $this->connection = $config['connection'];