From a6ced5ab78d8a3df718977edeafd74f9a7ff6a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E7=BB=84=E7=9A=84=E8=B5=B5=E6=97=A5=E5=A4=A9?= <295440026@qq.com> Date: Thu, 8 Mar 2018 09:03:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8Common=E6=96=87=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=EF=BC=88=E4=BF=AE=E5=A4=8D=EF=BC=89TP5?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E5=88=87=E6=8D=A2=E4=B8=8D=E5=86=99=E5=85=A5?= =?UTF-8?q?Cookie=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common.php | 11 +++++++++++ 1 file changed, 11 insertions(+) mode change 100755 => 100644 application/common.php diff --git a/application/common.php b/application/common.php old mode 100755 new mode 100644 index faeb9760a..862f55df9 --- a/application/common.php +++ b/application/common.php @@ -22,6 +22,17 @@ if (!function_exists('__')) array_shift($vars); $lang = ''; } + + //检测用户是否自主选择语言 + if(!think\Cookie::get('?think_var')) + { + //用户没有自主切换语言,自动对浏览器进行语言检测 + $lang = think\Lang::detect(); + + //语言切换cookie赋值 + think\Cookie::set('think_var',$lang); + } + return think\Lang::get($name, $vars, $lang); } -- Gitee