改进lang类的detect方法

This commit is contained in:
thinkphp
2016-06-22 15:41:36 +08:00
parent b696d6186b
commit 54d16627d7

View File

@@ -102,7 +102,7 @@ class Lang
public static function has($name, $range = '') public static function has($name, $range = '')
{ {
$range = $range ?: self::$range; $range = $range ?: self::$range;
return isset(self::$lang[$range][strtolower($name)]); return isset(self::$lang[$range][strtolower($name)]);
} }
/** /**
@@ -169,7 +169,7 @@ class Lang
} }
if (empty(self::$allowLangList) || in_array($langSet, self::$allowLangList)) { if (empty(self::$allowLangList) || in_array($langSet, self::$allowLangList)) {
// 合法的语言 // 合法的语言
self::$range = $langSet; self::$range = $langSet ?: self::$range;
} }
return self::$range; return self::$range;
} }