laravel的session过期后文件不会自动删除吗?

我本地试了一下,发现session过期后storage\framework\sessions内的文件不会自动删除?

阅读 6.5k
2 个回答

会覆盖,你看我找到了什么

https://github.com/laravel/framework/blob/5.1/src/Illuminate/Session/M...

// Here we will see if this request hits the garbage collection
lottery by hitting // the odds needed to perform garbage collection on
any given request. If we do // hit it, we'll call this handler to let
it delete all the expired sessions.

https://github.com/laravel/framework/blob/a423a55ed6601daebcbb75817de6...

gc 方法应该销毁所有比给定 $lifetime UNIX 时间戳记还旧的 session 数据。

http://laravel-china.org/docs/5.0/extending
https://github.com/laravel/framework/blob/5925ed9bae03c86ea0d6902568ca...
https://github.com/laravel/framework/blob/a423a55ed6601daebcbb75817de6...

可以把session文件存放目录设置为/tmp,配置项为config/session.phpfiles

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进