codeigniter会话频繁到期 [英] codeigniter session expires frequently
问题描述
我为我的应用程式使用codeigniter
我的问题是即使使用者在网站上活动,工作阶段即将到期。
这些是会话设置..我使用DB会话
$ config ['sess_cookie_name' ] ='ci_session';
$ config ['sess_expiration'] = 7200;
$ config ['sess_encrypt_cookie'] = FALSE;
$ config ['sess_use_database'] = TRUE;
$ config ['sess_table_name'] ='edu_sessions';
$ config ['sess_match_ip'] = FALSE;
$ config ['sess_match_useragent'] = TRUE;
$ config ['sess_time_to_update'] = 300;
$ b 帮助我必须修复它
这里是代码指示器论坛链接
解决方案我有CI会话随机过期的问题。你有AJAX或动态资源加载会话库吗?如果是这样,想象这个场景:
我提交一个ajax请求(它传递我的CI会话id与cookie),并返回结果,但我还提交紧跟在第一请求之后的一些其他请求(加载动态图像,另一AJAX请求等)。第一个请求可能会触发300秒的是时候更新事件,并传回一个新的Cookie,但是额外的请求是发送旧的会话ID,对吗?
因此,CodeIgniter说嘿你,你不能这样做,并创建一个新的会话,使两个cookie无效我的浏览器现在不知道该怎么办。
这里是一个论坛链接我张贴了一段时间,更详细的:
http://codeigniter.com/ forums / viewthread / 172415 /
I'm using codeigniter for my app
what my problem is session is expiring even though user is active on the site.
These are the session settings.. i'm using DB session
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'edu_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
any solution for this.
help me i have to fix it
here is the codeigniter forum link
解决方案 I've had issues with CI sessions expiring randomly. Do you have AJAX or dynamic resources loading the session library? If so, imagine this scenario:
I submit an ajax request (which passes in my CI session id with the cookie), and it returns the results, BUT I'm also submitting some other request (loading a dynamic image, another AJAX request, etc.) that immediately follows the first request. The first request might trigger the 300 second "it's time to update" event, and pass back a new cookie, but the additional request is sending the old session id, right?
So, CodeIgniter says "hey you, you can't do that" and creates a new session, invalidating both cookies my browser now doesn't know what to do with.
Here's a forum link I posted a while back that goes into more detail:
http://codeigniter.com/forums/viewthread/172415/
这篇关于codeigniter会话频繁到期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!