为什么账号密码一直报错?

WBOY
Release: 2016-07-06 13:51:35
Original
1368 people have browsed it

<code>public function postLogin(Request $request)
{
    if($input=Input::all()){
    if(!Auth::attempt(['phone' => $input['mobile'], 'password' => $input['password']])){
        return back()->with('msg', '用户名或者密码错误!');
    }
    return redirect('');
}</code>
Copy after login
Copy after login

用这种方法就一直报错,为什么啊,我试过了,账号密码是正确的,但一直报错是用户名或者密码错误

回复内容:

<code>public function postLogin(Request $request)
{
    if($input=Input::all()){
    if(!Auth::attempt(['phone' => $input['mobile'], 'password' => $input['password']])){
        return back()->with('msg', '用户名或者密码错误!');
    }
    return redirect('');
}</code>
Copy after login
Copy after login

用这种方法就一直报错,为什么啊,我试过了,账号密码是正确的,但一直报错是用户名或者密码错误

如果你确保你的用户名和密码是对的。那么就要看看你的Auth::attempt()是怎么处理用户名和密码的了,很有可能问题就在Auth::attempt()这里面

输出下执行的sql语句,看是否输入的用户密码正确

<code class="php">\DB::connection()->enableQueryLog();
$queries = \DB::getQueryLog();dd($queries );</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!