驱动设计支持使用 namespace配置改变默认命名空间位置

This commit is contained in:
thinkphp
2015-12-26 17:59:07 +08:00
parent bd322b82e5
commit a746982703
7 changed files with 19 additions and 11 deletions

View File

@@ -40,7 +40,7 @@ class Db
// 解析连接参数 支持数组和字符串
$options = self::parseConfig($config);
// 如果采用lite方式 仅支持原生SQL 包括query和execute方法
$class = $lite ? '\\think\\db\\Lite' : '\\think\\db\\driver\\' . ucwords($options['type']);
$class = $lite ? '\\think\\db\\Lite' : (!empty($options['namespace']) ? $options['namespace'] : '\\think\\db\\driver\\') . ucwords($options['type']);
self::$instances[$md5] = new $class($options);
}
self::$instance = self::$instances[$md5];