【发布时间】:2015-10-09 15:35:21
【问题描述】:
我正在尝试在我的登录功能中实现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(...) 时,它工作正常,但它总是重定向到索引路由。
我错过了什么吗?
感谢您的帮助!
【问题讨论】:
-
请记住,
intended()仅在您来自GET请求时才有效 -
我也是这么想的。我确保在
GET路由上填写了登录下拉表单,但这也不起作用。但是现在你提到它,processLogin 函数是一个POST请求......这会改变什么吗?
标签: php authentication laravel-5.1