Laravel auth :: attempt返回true,但是auth :: check()false为什么? [英] Laravel auth::attempt return true but auth::check() false why?
本文介绍了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
这篇关于Laravel auth :: attempt返回true,但是auth :: check()false为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文