简体   繁体   English

如何在Laravel中为单个会话变量设置Timer?

[英]How to set Timer for individual session variable in Laravel?

In my recent there is a situation where I retrieve a session data and I want to show the data suppose for 5 minutes after that it will kill the session. 在最近的情况下,我检索到会话数据,并且想在5分钟后显示该数据,否则它将终止会话。 Is there any way I can set timer for each session variable in Laravel? 有什么办法可以为Laravel中的每个会话变量设置计时器?

In the config/session.php , set the lifetime of the session. config/session.php ,设置会话的生存期。

'lifetime' => 5,

Also, comment out this field in php.ini to allow garbage collector to clean the expired session 另外,注释掉php.ini该字段,以允许垃圾收集器清理过期的会话

session.gc_maxlifetime

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM