首页 > 解决方案 > 标头不能包含多个标头 - 检测到新行

问题描述

标头不能包含多个标头,检测到新行

如何解决?

看法:

@if (Session::has('message-reset-password'))
    <div class="alert alert-info">{{ Session::get('message-reset-password') }}</div>
@endif

重置密码控制器:

public function redirectTo(){
    if (Auth::check()) {
        return redirect('profil')->with('message-reset-password', 'Hasło zostało zmienione.');
    } else {
        return redirect('login')->with('message-reset-password', 'Hasło zostało zmienione. Można teraz się zalogować.');
    }
}

标签: phplaravel

解决方案


方法redirectTo() 不能返回redirect(),它应该总是返回URL 路径

  public function redirectTo(){
        if (Auth::check()) {
            return '/somewhere/someuri';
        } else {
            return '/somewhere/someotheruri';
        }
    }

有关它的更多信息:https ://laravel.com/api/5.8/Illuminate/Auth/AuthenticationException.html#method_redirectTo


推荐阅读