改进多语言判断机制

This commit is contained in:
thinkphp
2022-10-25 22:59:38 +08:00
committed by F4nniu
parent 54f11e8b25
commit 34b0e2d7a8

View File

@@ -211,6 +211,12 @@ class Lang
}
}
if (preg_match('/^([a-z\d\-]+)/i', $langSet, $matches)) {
$langSet = strtolower($matches[1]);
} else {
$langSet = self::$range;
}
// 合法的语言
if (empty(self::$allowLangList) || in_array($langSet, self::$allowLangList)) {
self::$range = $langSet ?: self::$range;