改进config和lang类的文件加载信息日志记录

This commit is contained in:
thinkphp
2016-04-06 15:34:41 +08:00
parent 644adf60be
commit 164b73f0c3
2 changed files with 15 additions and 7 deletions

View File

@@ -56,9 +56,13 @@ class Config
if (!isset(self::$config[$range])) { if (!isset(self::$config[$range])) {
self::$config[$range] = []; self::$config[$range] = [];
} }
if (is_file($file)) {
// 记录加载信息 // 记录加载信息
APP_DEBUG && Log::record('[ CONFIG ] ' . $file, 'info'); APP_DEBUG && Log::record('[ CONFIG ] ' . $file, 'info');
return is_file($file) ? self::set(include $file, $name, $range) : self::$config[$range]; return self::set(include $file, $name, $range);
} else {
return self::$config[$range];
}
} }
/** /**

View File

@@ -67,9 +67,13 @@ class Lang
} }
$lang = []; $lang = [];
foreach ($file as $_file) { foreach ($file as $_file) {
if (is_file($_file)) {
// 记录加载信息 // 记录加载信息
APP_DEBUG && Log::record('[ LANG ] ' . $_file, 'info'); APP_DEBUG && Log::record('[ LANG ] ' . $_file, 'info');
$_lang = is_file($_file) ? include $_file : []; $_lang = include $_file;
} else {
$_lang = [];
}
$lang = array_change_key_case($_lang) + $lang; $lang = array_change_key_case($_lang) + $lang;
} }
if (!empty($lang)) { if (!empty($lang)) {