【发布时间】:2018-07-06 13:25:21
【问题描述】:
我有下一个代码:
/*
* If the route has someroute/en
* where en is the lang of the page
*/
$locale = $request->route('locale');
if ( $locale != null ) {
// 1. dd($locale)
Session::put('_lang', $locale);
} else {
dd($request->session());
}
所以当我运行没有 1. 注释的代码时,我得到了“en”。然后我删除了 dd($locale),然后运行 Session:put()。因此,当我去某个路线或从路线中删除 /en 时,我得到的是“favicon.ico”而不是“en”。 有人知道为什么会这样吗?
额外:我在中间件上使用它,即在“网络”阵列上。我也使用文件作为我的会话存储。
【问题讨论】:
-
这可能表明您的重写规则搞砸了,并将
favicon.ico捕获为框架请求而不是静态资源(或者您没有favicon.ico文件)跨度>
标签: php laravel session middleware