mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
删除一些不需要的配置参数
This commit is contained in:
@@ -180,8 +180,6 @@ return [
|
|||||||
// | 数据库设置
|
// | 数据库设置
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
'db_fields_strict' => true,
|
|
||||||
'db_attr_case' => \PDO::CASE_LOWER,
|
|
||||||
'database' => [
|
'database' => [
|
||||||
// 数据库类型
|
// 数据库类型
|
||||||
'type' => 'mysql',
|
'type' => 'mysql',
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
|
|
||||||
namespace think;
|
namespace think;
|
||||||
|
|
||||||
|
use think\Config;
|
||||||
|
use think\Cookie;
|
||||||
|
|
||||||
class Lang
|
class Lang
|
||||||
{
|
{
|
||||||
// 语言参数
|
// 语言参数
|
||||||
@@ -136,17 +139,17 @@ class Lang
|
|||||||
if (isset($_GET[$langDetectVar])) {
|
if (isset($_GET[$langDetectVar])) {
|
||||||
// url中设置了语言变量
|
// url中设置了语言变量
|
||||||
$langSet = strtolower($_GET[$langDetectVar]);
|
$langSet = strtolower($_GET[$langDetectVar]);
|
||||||
\think\Cookie::set($langCookieVar, $langSet, 3600);
|
Cookie::set($langCookieVar, $langSet, 3600);
|
||||||
} elseif (\think\Cookie::get($langCookieVar)) {
|
} elseif (Cookie::get($langCookieVar)) {
|
||||||
// 获取上次用户的选择
|
// 获取上次用户的选择
|
||||||
$langSet = strtolower(\think\Cookie::get($langCookieVar));
|
$langSet = strtolower(Cookie::get($langCookieVar));
|
||||||
} elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
} elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||||
// 自动侦测浏览器语言
|
// 自动侦测浏览器语言
|
||||||
preg_match('/^([a-z\d\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches);
|
preg_match('/^([a-z\d\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches);
|
||||||
$langSet = strtolower($matches[1]);
|
$langSet = strtolower($matches[1]);
|
||||||
\think\Cookie::set($langCookieVar, $langSet, 3600);
|
Cookie::set($langCookieVar, $langSet, 3600);
|
||||||
}
|
}
|
||||||
if (in_array($langSet, \think\Config::get('lang_list'))) {
|
if (in_array($langSet, Config::get('lang_list'))) {
|
||||||
// 合法的语言
|
// 合法的语言
|
||||||
self::$range = $langSet;
|
self::$range = $langSet;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user