mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-09 08:02:48 +08:00
优化代码规范
This commit is contained in:
@@ -30,7 +30,7 @@ class Config
|
|||||||
if (empty($type)) {
|
if (empty($type)) {
|
||||||
$type = substr(strrchr($config, '.'), 1);
|
$type = substr(strrchr($config, '.'), 1);
|
||||||
}
|
}
|
||||||
$class = '\\think\\config\driver\\' . strtolower($type);
|
$class = '\\think\\config\\driver\\' . strtolower($type);
|
||||||
self::set((new $class())->parse($config), '', $range);
|
self::set((new $class())->parse($config), '', $range);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Db
|
|||||||
// 解析连接参数 支持数组和字符串
|
// 解析连接参数 支持数组和字符串
|
||||||
$options = self::parseConfig($config);
|
$options = self::parseConfig($config);
|
||||||
// 如果采用lite方式 仅支持原生SQL 包括query和execute方法
|
// 如果采用lite方式 仅支持原生SQL 包括query和execute方法
|
||||||
$class = $lite ? 'think\db\lite' : 'think\\db\\driver\\' . strtolower($options['type']);
|
$class = $lite ? 'think\\db\\lite' : 'think\\db\\driver\\' . strtolower($options['type']);
|
||||||
self::$instance[$md5] = new $class($options);
|
self::$instance[$md5] = new $class($options);
|
||||||
}
|
}
|
||||||
self::$_instance = self::$instance[$md5];
|
self::$_instance = self::$instance[$md5];
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class Loader
|
|||||||
// 注册自动加载机制
|
// 注册自动加载机制
|
||||||
public static function register($autoload = '')
|
public static function register($autoload = '')
|
||||||
{
|
{
|
||||||
spl_autoload_register($autoload ? $autoload : ['think\loader', 'autoload']);
|
spl_autoload_register($autoload ? $autoload : ['think\\loader', 'autoload']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,7 +124,7 @@ class Loader
|
|||||||
if (strpos($name, ':')) {
|
if (strpos($name, ':')) {
|
||||||
list($class, $name) = explode(':', $name);
|
list($class, $name) = explode(':', $name);
|
||||||
} else {
|
} else {
|
||||||
$class = 'think\model';
|
$class = 'think\\model';
|
||||||
}
|
}
|
||||||
$guid = $name . '_' . $class;
|
$guid = $name . '_' . $class;
|
||||||
if (!isset($_model[$guid])) {
|
if (!isset($_model[$guid])) {
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ return [
|
|||||||
'think\Db' => CORE_PATH . 'db' . EXT,
|
'think\Db' => CORE_PATH . 'db' . EXT,
|
||||||
'think\Db\Driver' => CORE_PATH . 'db/driver' . EXT,
|
'think\Db\Driver' => CORE_PATH . 'db/driver' . EXT,
|
||||||
'think\Template' => CORE_PATH . 'template' . EXT,
|
'think\Template' => CORE_PATH . 'template' . EXT,
|
||||||
'think\view\driver\Think' => CORE_PATH . 'view\driver\think' . EXT,
|
'think\view\driver\Think' => CORE_PATH . 'view/driver/think' . EXT,
|
||||||
'think\template\driver\File' => CORE_PATH . 'template\driver\file' . EXT,
|
'think\template\driver\File' => CORE_PATH . 'template/driver/file' . EXT,
|
||||||
'think\Error' => CORE_PATH . 'error' . EXT,
|
'think\Error' => CORE_PATH . 'error' . EXT,
|
||||||
'think\Cache' => CORE_PATH . 'cache' . EXT,
|
'think\Cache' => CORE_PATH . 'cache' . EXT,
|
||||||
'think\cache\driver\File' => CORE_PATH . 'cache/driver/file' . EXT,
|
'think\cache\driver\File' => CORE_PATH . 'cache/driver/file' . EXT,
|
||||||
|
|||||||
Reference in New Issue
Block a user