mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
完善config类的load方法
This commit is contained in:
@@ -33,6 +33,7 @@ class Config
|
|||||||
if (empty($type)) {
|
if (empty($type)) {
|
||||||
$type = substr(strrchr($config, '.'), 1);
|
$type = substr(strrchr($config, '.'), 1);
|
||||||
}
|
}
|
||||||
|
$range = $range ? $range : self::$range;
|
||||||
$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);
|
||||||
}
|
}
|
||||||
@@ -40,7 +41,8 @@ class Config
|
|||||||
// 加载配置文件
|
// 加载配置文件
|
||||||
public static function load($file, $name = '', $range = '')
|
public static function load($file, $name = '', $range = '')
|
||||||
{
|
{
|
||||||
$file = strpos($file, '.') ? $file : APP_PATH . $file . EXT;
|
$range = $range ? $range : self::$range;
|
||||||
|
$file = strpos($file, '.') ? $file : APP_PATH . $file . EXT;
|
||||||
if (!isset(self::$config[$range])) {
|
if (!isset(self::$config[$range])) {
|
||||||
self::$config[$range] = [];
|
self::$config[$range] = [];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user