在Common文件中兼容(修复)TP5语言切换不写入Cookie的问题

pull/47/head
龙组的赵日天 2018-03-08 09:03:37 +08:00
parent 5155d80295
commit a6ced5ab78
1 changed files with 11 additions and 0 deletions

11
application/common.php 100755 → 100644
View File

@ -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);
}