改进数据表的前缀设置

This commit is contained in:
thinkphp
2015-02-25 10:50:58 +08:00
parent c6395bc3bf
commit 9e44381f6f
2 changed files with 3 additions and 1 deletions

View File

@@ -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]);
}
/**

View File

@@ -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'];