From 411df30e578eddcbe1c48a9b20185c828a32df7d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 20 Jan 2016 20:36:40 +0800 Subject: [PATCH] =?UTF-8?q?Config=E7=B1=BBload=E6=96=B9=E6=B3=95=E8=B0=83?= =?UTF-8?q?=E6=95=B4=20=E5=BF=85=E9=A1=BB=E7=BB=99=E5=87=BA=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 6 +++--- library/think/Config.php | 1 - tests/thinkphp/library/think/configTest.php | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/library/think/App.php b/library/think/App.php index f2a199d4..0dba6fe8 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -34,7 +34,7 @@ class App // 读取扩展配置文件 if (Config::get('extra_config_list')) { foreach (Config::get('extra_config_list') as $file) { - Config::load($file, $file); + Config::load(APP_PATH . $file . EXT, $file); } } @@ -287,11 +287,11 @@ class App } else { $path = APP_PATH . $module; // 加载模块配置 - Config::load($module . 'config'); + Config::load(APP_PATH . $module . 'config' . EXT); // 加载应用状态配置 if ($config['app_status']) { - Config::load($module . $config['app_status']); + Config::load(APP_PATH . $module . $config['app_status'] . EXT); } // 加载别名文件 diff --git a/library/think/Config.php b/library/think/Config.php index 75b59514..b6a4d365 100644 --- a/library/think/Config.php +++ b/library/think/Config.php @@ -55,7 +55,6 @@ class Config public static function load($file, $name = '', $range = '') { $range = $range ?: self::$range; - $file = strpos($file, '.') ? $file : APP_PATH . $file . EXT; if (!isset(self::$config[$range])) { self::$config[$range] = []; } diff --git a/tests/thinkphp/library/think/configTest.php b/tests/thinkphp/library/think/configTest.php index 92b46788..a0167056 100644 --- a/tests/thinkphp/library/think/configTest.php +++ b/tests/thinkphp/library/think/configTest.php @@ -46,8 +46,8 @@ class configTest extends \PHPUnit_Framework_TestCase public function testLoad() { - $file = 'config'; - $config = array_change_key_case(include APP_PATH . $file . EXT); + $file = include APP_PATH . 'config' . EXT; + $config = array_change_key_case(include $file); $name = '_name_'; $range = '_test_';