From 263598458fb3ce3037ed39dd6a5110e28ed445c9 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 3 Apr 2013 13:47:12 +0800 Subject: [PATCH] =?UTF-8?q?Think\Config=E7=B1=BB=E7=9A=84parse=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20=E6=94=AF=E6=8C=81=E8=87=AA=E5=8A=A8=E8=AF=86?= =?UTF-8?q?=E5=88=AB=20=E8=A7=A3=E6=9E=90=E6=96=87=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=20Config::parse('my=5Fconfig.ini','ini');=20=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E7=AE=80=E5=8C=96=E6=88=90=20Config::parse('my=5Fconf?= =?UTF-8?q?ig.ini');?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Think/Config.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Think/Config.php b/Think/Config.php index 42b66eb7..acd64f20 100644 --- a/Think/Config.php +++ b/Think/Config.php @@ -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); }