改进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])) {
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];
}
}
/**

View File

@@ -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];