mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
修正config类的set方法返回值问题
This commit is contained in:
@@ -22,6 +22,9 @@ class Config
|
|||||||
public static function range($range)
|
public static function range($range)
|
||||||
{
|
{
|
||||||
self::$range = $range;
|
self::$range = $range;
|
||||||
|
if (!isset(self::$config[$range])) {
|
||||||
|
self::$config[$range] = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析其他格式的配置参数
|
// 解析其他格式的配置参数
|
||||||
@@ -38,6 +41,9 @@ class Config
|
|||||||
public static function load($file, $name = '', $range = '')
|
public static function load($file, $name = '', $range = '')
|
||||||
{
|
{
|
||||||
$file = strpos($file, '.') ? $file : APP_PATH . $file . EXT;
|
$file = strpos($file, '.') ? $file : APP_PATH . $file . EXT;
|
||||||
|
if (!isset(self::$config[$range])) {
|
||||||
|
self::$config[$range] = [];
|
||||||
|
}
|
||||||
return is_file($file) ? self::set(include $file, $name, $range) : self::$config[$range];
|
return is_file($file) ? self::set(include $file, $name, $range) : self::$config[$range];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +113,8 @@ class Config
|
|||||||
return self::$config[$range] = array_merge(self::$config[$range], array_change_key_case($name));
|
return self::$config[$range] = array_merge(self::$config[$range], array_change_key_case($name));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return null; // 避免非法参数
|
// 为空直接返回 已有配置
|
||||||
|
return self::$config[$range];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user