且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel会话在每个负载重新生成

更新时间:2023-02-04 10:40:23

我的问题是我在我的函数中有echo语句。

My problem was that I had echo statements in my function. It was keeping the session from being properly created/stored.

我在我的返回重定向之前有一个回显,所以重定向没有得到会话...

I had an echo before my 'return Redirect' so the redirect didn't get the session...

public function login()
{
    // auth
    if (Auth::attempt(Input::only('email', 'password'), true))
    {
        return Redirect::route('companies.index');
    }
    // failed -> back to login
    return Redirect::back()->withErrors(['email' => 'Login failed.'])->withInput();
}

详情: http://brainwashinc.com/2014/02/17/laravel-sessions-not-working-in-4-1/