Laravel 4会话后使用寿命限制不会过期 [英] Laravel 4 session doesn't expire after lifetime limit

查看:473
本文介绍了Laravel 4会话后使用寿命限制不会过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置'终身'=> 10 在我的会话配置文件,但它不会过期的。

I've set 'lifetime' => 10 in my session config file, but it doesn't expire at all.

在laravel 3与设置,登录后,超过10分钟限制时,会话过期正确和用户被重定向到重新登录。

In laravel 3 with that setting, after logging in, when limit of 10 minutes is exceeded, the session expires properly and user is redirected to login again.

在laravel 4它不会发生。 10分钟后我可以刷新,做任何事情,仍然会是有效的。

In laravel 4 it doesn't happen. After 10 minutes I can refresh, do anything and still session is valid.

我在同一台机器上用类比的设置同时测试...我缺少什么?

I'm testing both on the same machine with analogical settings... What am I missing?

推荐答案

我知道了。问题是与配置对寿命 expire_on_close

I've got it. The problem was with the config pair lifetime and expire_on_close.

如果 expire_on_close 设置为true,laravel 4会忽略寿命。我有:

If expire_on_close is set to true, laravel 4 will ignore lifetime. I had:

'lifetime' => 1,
'expire_on_close' => true,

在这种情况下,会话1分钟后,有效的 - 它不仅会关闭浏览器后过期。我把它改为:

and in this case, session was valid after 1 min - it would only expire after closing browser. I changed it to:

'lifetime' => 1,
'expire_on_close' => false,

和现在会话1分钟后到期。不管浏览器关闭与否 - 足够接近我想要的东西。

and now session is expiring after 1 min. no matter if browser is closed or not - close enough to what I've wanted.

为什么我很困惑,也没有想通了早期是该意见有在此问题上不明确,而且在Laravel 3它的工作不同的原因...

The reason why I was confused and haven't figured it out earlier was that the comments there are unclear in that matter and that in Laravel 3 it worked differently...

这篇关于Laravel 4会话后使用寿命限制不会过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆