app\common\middleware\LoadLangPack.php
注释掉以下:
public function handle(中的以下几行
if ($name=='index') {
$oldLang = $this->app->cookie->get('old_'.$name.'_'.config('lang')['cookie_var']);
if ($defaultLang!=$oldLang) {
app()->make(\app\common\services\cache\CacheService::class)->clearFile('temp', 'index');
}}if ($name=='index') {
$this->app->cookie->set('old_'.$name.'_'.config('lang')['cookie_var'], $defaultLang);
}
public function detect(中的以下几行
elseif ($request->cookie(app()->http->getName().'_'.$config['cookie_var'])) {
// Cookie中设置了语言变量
$langSet = strtolower($request->cookie(app()->http->getName().'_'.$config['cookie_var']));
}elseif ($request->server('HTTP_ACCEPT_LANGUAGE')) {
// 自动侦测浏览器语言,不在检测浏览器语言【废弃】
$langSet = $request->server('HTTP_ACCEPT_LANGUAGE');
}
发表评论 取消回复