Laravel 5.1 - redirect->intended()返回" HTTP状态码&;1&;无效.&q


Laravel 5.1 - redirect->intended() returns "The HTTP status code "1" is not valid."

我试图在我的登录函数中实现redirect()->intended()方法,以使现在登录的用户回到他来自的地方,但我总是得到这个错误:

Response.php第470行InvalidArgumentException: HTTP状态代码"1"无效。'

public function processLogin($region, $lang)
{
  if (Auth::attempt(['email' => $_POST['email'], 'password' => $_POST['password'], 'active' => 1])) {
        return redirect()->intended('index', array('region' => 'ca', 'lang' => 'fr')); // line that messes up
    }
  return redirect()->route('login', array('region' => 'ca', 'lang' => 'fr'))->withErrors('invalid login');
}

当我将intended(...)更改为route(...)时,它工作正常,但它总是重定向到索引路由。

我错过什么了吗?

谢谢你的帮助!

试试这个。重定向HTTP code 1不允许您使用另一个参数。重定向意味着你正在发送请求来显示特定的页面,在视图和重定向之间存在差异。

我希望这有助于…:)

if (Auth::attempt(['email' => $_POST['email'], 'password' => $_POST['password'], 'active' => 1])) {
    return redirect('index');
}