mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
Think\Config类的parse方法 支持自动识别 解析文件类型
Config::parse('my_config.ini','ini');
可以简化成
Config::parse('my_config.ini');
This commit is contained in:
@@ -19,7 +19,10 @@ class Config {
|
||||
}
|
||||
|
||||
// 解析其他格式的配置参数
|
||||
static public function parse($config,$type,$range=''){
|
||||
static public function parse($config,$type='',$range=''){
|
||||
if(empty($type)) {
|
||||
$type = strtolower(substr(strrchr($config, '.'),1));
|
||||
}
|
||||
$class = '\Think\Config\Driver\\'.ucwords($type);
|
||||
self::set((new $class())->parse($config),'',$range);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user