Laravel auth :: attempt返回true,但是auth :: check()false为什么?
问题描述:
为什么打印0?我认为当我成功验证用户身份时,它应该打印1.请帮忙.
It prints 0 why? I think it should print 1 when I successfully authenticate the user. Please help.
if (Auth::attempt($userdata,true))
{
return Redirect::to('home');
} else
{
return Redirect::to('login');
}
它将我重定向到主页,但是当我检查
It redirects me to the home page but when I check
if(Auth::check())
{
echo '1';
}else
{
echo '0';
}
答
您的路由是否在Web中间件路由组内? https://laravel.com/docs/5.2/routing#basic-routing
Are your routes inside the web middleware route group? https://laravel.com/docs/5.2/routing#basic-routing