diff --git a/library/think/App.php b/library/think/App.php index a9236f6f..b781d75b 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -12,6 +12,7 @@ namespace think; use think\Config; +use think\Env; use think\Exception; use think\exception\HttpException; use think\exception\HttpResponseException; @@ -371,7 +372,7 @@ class App self::$suffix = $config['class_suffix']; // 应用调试模式 - self::$debug = Config::get('app_debug'); + self::$debug = Env::get('app_debug', Config::get('app_debug')); if (!self::$debug) { ini_set('display_errors', 'Off'); } elseif (!IS_CLI) { diff --git a/library/think/Config.php b/library/think/Config.php index 7256e0ed..5ab032fd 100644 --- a/library/think/Config.php +++ b/library/think/Config.php @@ -81,20 +81,10 @@ class Config $range = $range ?: self::$range; if (!strpos($name, '.')) { - // 判断环境变量 - $result = getenv(ENV_PREFIX . strtoupper($name)); - if (false !== $result) { - return $result; - } return isset(self::$config[$range][strtolower($name)]); } else { // 二维数组设置和获取支持 - $name = explode('.', $name); - $result = getenv(ENV_PREFIX . strtoupper($name[0] . '_' . $name[1])); - // 判断环境变量 - if (false !== $result) { - return $result; - } + $name = explode('.', $name); return isset(self::$config[$range][strtolower($name[0])][$name[1]]); } } @@ -114,20 +104,11 @@ class Config } if (!strpos($name, '.')) { - $result = getenv(ENV_PREFIX . strtoupper($name)); - if (false !== $result) { - return $result; - } $name = strtolower($name); return isset(self::$config[$range][$name]) ? self::$config[$range][$name] : null; } else { // 二维数组设置和获取支持 - $name = explode('.', $name); - $result = getenv(ENV_PREFIX . strtoupper($name[0] . '_' . $name[1])); - // 判断环境变量 - if (false !== $result) { - return $result; - } + $name = explode('.', $name); $name[0] = strtolower($name[0]); return isset(self::$config[$range][$name[0]][$name[1]]) ? self::$config[$range][$name[0]][$name[1]] : null; }