search

Home  >  Q&A  >  body text

How to set session expiration time in laravel

$request->session()->put('code',$code);

How to set the expiration time when creating a session

'lifetime' => 120,

Are there any other setting methods besides this setting?

阿神阿神2778 days ago969

reply all(1)I'll reply

  • 某草草

    某草草2017-05-16 16:50:16

    I guess you want to set a longer time for some values, right.

    Then you should use cache来做哦,Session的初衷就是保存用户会话的东西,一般也只保存登录用户的一些信息。
    只要用户在有效期内持续访问,Sessionit will automatically extend

    For example, the Cache key name is: user-12-some

    reply
    0
  • Cancelreply