From 164b73f0c34396e682e99801af42f3b75a6bf1cb Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 6 Apr 2016 15:34:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bconfig=E5=92=8Clang=E7=B1=BB?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6=E5=8A=A0=E8=BD=BD=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Config.php | 10 +++++++--- library/think/Lang.php | 12 ++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/library/think/Config.php b/library/think/Config.php index 7f4f829c..8be69135 100644 --- a/library/think/Config.php +++ b/library/think/Config.php @@ -56,9 +56,13 @@ class Config if (!isset(self::$config[$range])) { self::$config[$range] = []; } - // 记录加载信息 - APP_DEBUG && Log::record('[ CONFIG ] ' . $file, 'info'); - return is_file($file) ? self::set(include $file, $name, $range) : self::$config[$range]; + if (is_file($file)) { + // 记录加载信息 + APP_DEBUG && Log::record('[ CONFIG ] ' . $file, 'info'); + return self::set(include $file, $name, $range); + } else { + return self::$config[$range]; + } } /** diff --git a/library/think/Lang.php b/library/think/Lang.php index 22bccc96..ca0d944c 100644 --- a/library/think/Lang.php +++ b/library/think/Lang.php @@ -67,10 +67,14 @@ class Lang } $lang = []; foreach ($file as $_file) { - // 记录加载信息 - APP_DEBUG && Log::record('[ LANG ] ' . $_file, 'info'); - $_lang = is_file($_file) ? include $_file : []; - $lang = array_change_key_case($_lang) + $lang; + if (is_file($_file)) { + // 记录加载信息 + APP_DEBUG && Log::record('[ LANG ] ' . $_file, 'info'); + $_lang = include $_file; + } else { + $_lang = []; + } + $lang = array_change_key_case($_lang) + $lang; } if (!empty($lang)) { self::$lang[$range] = $lang + self::$lang[$range];