Codeigniter的sess_time_to_update如何工作 [英] How does Codeigniter's sess_time_to_update work

查看:151
本文介绍了Codeigniter的sess_time_to_update如何工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于以下问题/答案
CodeIgniter会话类不是在Chrome中工作

我遇到的问题是,人们无法从远离美国服务器的另一个国家登录我的网站。在网上搜索后,我偶然发现了一条建议,该建议根据服务器的时区和用户的时区之间的差异来描述问题的根源。因此,通过扩展session_expiration,我设法解决了这个问题,并且人们能够成功登录。

I had the problem where people are unable to login to my website from another country which is far from the US server. After searching online I've stumbled upon a suggestion which describes how the the problem is based on the difference between the server's timezone and the user's timezone. So, by extending the session_expiration I've managed to get around the problem and people are able to log in successfully.

我的问题是sess_time_to_update是否创建新的时间戳,由于新的时间戳位于错误的时区,它是否会注销用户?我必须将新的sess_time_to_update设置为17小时以上,以便它涵盖我所链接的问题中所述的最广泛的时区。还有其他方法可以根据用户的本地时间在用户的浏览器中存储会话(而无需要求他们在配置文件中选择时区和其他类型的用户不友好方案)。我想要2小时的默认会话过期时间+ 800秒。更新时间。我不使用数据库来存储会话,我宁愿不使用它。

My questions is whether the sess_time_to_update creates a new timestamp and it will logout the user because the new timestamp is in the wrong timezone? Do I have to make the new sess_time_to_update 17+ hours so that it covers the broadest range of timezones as explained in the question that I've linked. Is there some other way of storing the session at the user's browser based on their localtime (without asking them to choose timezones in the profiles and other sorts of user unfriendly schemes). I would like to have a 2h default session expiration time + the 800sec. update time. I'm not using the database to store the session and I would rather not use it.

推荐答案

sess_time_to_update 设置是会话详细信息(例如上一个活动)的更新频率。默认值为每5分钟(300秒),并且将生成一个新的会话ID。这将根据 sess_expiration 设置重置到期日期。

The sess_time_to_update setting is how often the session details (such as last activity) are updated. The default is every 5 minutes (300 seconds) and a new session ID will be generated. This would reset the expiration date based on the sess_expiration setting.

我建议将 sess_time_to_update 保留为默认值(或更低),因为这样可以使用户会话的寿命更长因为会话到期将不断重置。可能需要保持较高的唯一设置是 sess_expiration ,也就是说,除非您可以确定用户的时区。

I would suggest keeping the sess_time_to_update at the default (or lower) as that would keep the user session alive longer since the session expiration would keep getting reset. The only setting that may need to remain high would be sess_expiration, that is unless you can determine the users timezone.

您可以尝试几种方法来确定用户的时区。一种可能是Javascript(例如:客户端时区偏移量),或者您可以尝试使用 PHP的GEOIP 方法。

There are a couple of ways you could try to determine the users timezone. One would be Javascript (Example: Client Side Timezone Offsetting) or you could try using PHP's GEOIP Methods.

这篇关于Codeigniter的sess_time_to_update如何工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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