mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-10 00:22:48 +08:00
改进数据表的前缀设置
This commit is contained in:
2
base.php
2
base.php
@@ -90,7 +90,7 @@ function G($start,$end='',$dec=6) {
|
|||||||
* @return Model
|
* @return Model
|
||||||
*/
|
*/
|
||||||
function M($name='', $tablePrefix='',$connection='') {
|
function M($name='', $tablePrefix='',$connection='') {
|
||||||
return think\Loader::table($name,['table_prefix'=>$tablePrefix,'connection'=>$connection]);
|
return think\Loader::table($name,['prefix'=>$tablePrefix,'connection'=>$connection]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ class Model {
|
|||||||
|
|
||||||
if(isset($config['prefix'])) {
|
if(isset($config['prefix'])) {
|
||||||
$this->tablePrefix = $config['prefix'];
|
$this->tablePrefix = $config['prefix'];
|
||||||
|
}else{
|
||||||
|
$this->tablePrefix = Config::get('database.prefix');
|
||||||
}
|
}
|
||||||
if(isset($config['connection'])) {
|
if(isset($config['connection'])) {
|
||||||
$this->connection = $config['connection'];
|
$this->connection = $config['connection'];
|
||||||
|
|||||||
Reference in New Issue
Block a user