From df8a027c63d5ef5b8c9077e5c90055b9ad57bb98 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 24 Apr 2016 16:06:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=80=E4=BA=9B=E4=B8=8D?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E7=9A=84=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- convention.php | 2 -- library/think/Lang.php | 13 ++++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/convention.php b/convention.php index 9d86e2f6..138cb4f7 100644 --- a/convention.php +++ b/convention.php @@ -180,8 +180,6 @@ return [ // | 数据库设置 // +---------------------------------------------------------------------- - 'db_fields_strict' => true, - 'db_attr_case' => \PDO::CASE_LOWER, 'database' => [ // 数据库类型 'type' => 'mysql', diff --git a/library/think/Lang.php b/library/think/Lang.php index ca0d944c..c71d36e4 100644 --- a/library/think/Lang.php +++ b/library/think/Lang.php @@ -11,6 +11,9 @@ namespace think; +use think\Config; +use think\Cookie; + class Lang { // 语言参数 @@ -136,17 +139,17 @@ class Lang if (isset($_GET[$langDetectVar])) { // url中设置了语言变量 $langSet = strtolower($_GET[$langDetectVar]); - \think\Cookie::set($langCookieVar, $langSet, 3600); - } elseif (\think\Cookie::get($langCookieVar)) { + Cookie::set($langCookieVar, $langSet, 3600); + } elseif (Cookie::get($langCookieVar)) { // 获取上次用户的选择 - $langSet = strtolower(\think\Cookie::get($langCookieVar)); + $langSet = strtolower(Cookie::get($langCookieVar)); } elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // 自动侦测浏览器语言 preg_match('/^([a-z\d\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches); $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; }