用户会话不断过期 [英] User session keeps expiring
问题描述
我有一个上传表单,需要花费用户30分钟左右.去完成.他们在此页面上的整个空闲时间.我使用ini_set()函数.您可以在此处查看上传页面的顶部:
I have an upload form that takes a user about 30 min. to complete. The whole time they're idle on this page. I use the ini_set() function. You can see the top of the upload page here:
<?php
session_start();
ini_set('session.gc_maxlifetime',10080);
?>
持续发生的情况是用户闲置了30分钟或更长时间.数据将被截断,并且User_id被记录为NULL值.我完全不知道这是怎么发生的.我最初在php.ini中设置了maxlifetime,但是这使缓存的会话数据过载.因此,我只是使用ini_set.为什么会弄乱数据而不会记录user_id.注意:如果您填写表格的速度足够快,则不会有任何问题.
What keeps happening is if a user is idle for 30 or more min. the data gets truncated and the User_id is recorded as a NULL value. I'm completely baffled how this is happening. I initially set the maxlifetime in the php.ini but that overloaded the cached session data. So, I'm just using ini_set. Why would the data be getting messed up and the user_id not be getting recorded. Note: if you do the form fast enough there's no issues.
推荐答案
您应在session_start()
之前使用ini_set()
.
这篇关于用户会话不断过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!