search

Home  >  Q&A  >  body text

Laravel's users table has a remember_token field, what is its role?

Laravel's users table has a remember_token field. What is its function?

PHP中文网PHP中文网2827 days ago597

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-05-16 16:52:32

    That is, when the user logs in, for example, there is

    账号 <inout type="text" name="username">
    密码 <inout type="password" name="password">
    <input type="checkbox" value="1" name="remember_me" > 保存登录
    

    When "Save Login" is selected, according to the Login interface below, you can remember_tokensave a random Token in Cookie and database users. You do not need to re-enter your account and password to log in for a period of time in the future.

    Login interface

    Auth::guard()->attempt(['username' => 'admin', 'password' => '123456'], $request->input('remember_me')); //第二个参数TRUE则保存

    Determine whether the user is logged in (including remember_me)

    Auth::guard()->check();

    Please check (laravel 5.3) for details

    .\vendor\laravel\framework\src\Illuminate\Auth\Guard.php

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 16:52:32

    Doesn’t that literally mean “remember me”…

    reply
    0
  • Cancelreply