简体   繁体   中英

Laravel 5.5 Session::put() stores 'favicon.ico'

I have the next code:

    /*
    * 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());
    }

So when I run the code without the 1. commented, I got "en". Then I removed that dd($locale), and let run the Session:put(). So when I go to a route or the same removing the /en from the route I got 'favicon.ico' instead of 'en'. Does anyone have any idea of why this is happening?

Extra: I'm using this on a middleware, that is on the 'web' array. Also I'm using file as my session storage.

Thanks to @apokryfos

I did not have a favicon.ico under my 'public' directory.

Make sure you write the full path to your favicon.ico For Emx.

<link href="http://www.example.com/favicon.ico" rel="shortcut icon">

or

<link href="{{asset('/favicon.ico')}}" rel="shortcut icon">

NOT only file name like ( href="favicon.ico" )

Also make sure you have this file in your 'public' or 'public_html' root.

Laravel adds an empty favicon.ico file (0KB) in to avoid these problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM