【问题标题】:codeigniter session config filecodeigniter 会话配置文件
【发布时间】:2013-04-03 05:43:22
【问题描述】:

codeigniter 会话的配置文件中有 2 个值,我不完全理解,希望有人能启发我,谢谢。

# the number of SECONDS you want the session to last.
# by default sessions last 7200 seconds (two hours).
# Set to zero for no expiration.
$config['sess_expiration'] = 7200;  

Q1) 即使用户仍在积极使用应用程序,应用程序是否会在时间(登录后 2 小时)结束时注销用户?

# how many seconds between CI refreshing Session Information
$config['sess_time_to_update'] = 300;  

Q2) 这个值会影响 (Q1) 情景吗?

【问题讨论】:

    标签: codeigniter session


    【解决方案1】:

    $config['sess_expiration'] 是如果用户在会话中没有任何活动,则会话到期之前需要多长时间。 $config['sess_time_to_update'] 将在用户积极使用会话时每 5 分钟更新一次过期时间。

    因此,如果用户在 2 小时内登录,并在网站上浏览 30 分钟然后离开该网站,他们将有 2 小时的时间再次访问而无需登录。如果他们在这 2 小时内访问,过期时间将从那时起重置为 2 小时。如果他们不再访问,则需要登录。

    因此,如果他们正在使用会话,他们将不会在 2 小时后退出。

    【讨论】:

    • 嗨,我设置了 $config['sess_expiration'] = 60;。即使我仍在积极使用它,我也在 60 秒后注销。发生了什么?
    • 我设置了 sess_time_to_update = 120。我也在使用会话数据库。
    • 如果您不想在 sess_expiration 之后退出,sess_time_to_update 必须低于 sess_expiration。
    猜你喜欢
    • 2012-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多