CodeIgniter破坏了我的会话而没有 [英] CodeIgniter destroying my session without

查看:53
本文介绍了CodeIgniter破坏了我的会话而没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我当前的任务涉及一个站点,人们可以在该站点上登录并查看有关特定主题的一系列培训视频。我是在CodeIgniter中开发的。唯一的麻烦是,一旦我让他们登录并创建了一个会话,该会话似乎在几分钟后就神秘地消失了,而它们又被神秘地弹回到了登录页面(如果有人在培训视频页面而无需登录。这是我config.php页面中的代码块:

So, my current task involves a site where people can sign in, and view a series of training videos on a particular topic. I developed this within CodeIgniter. The only trouble is that once I have them log in, and I create a session, that session seems to mysteriously disappear after a few minutes, and they're mysteriously bounced back to the login page (which is what happens if someone is on the training video page without being signed in. This is the block of code in my config.php page:

$config['sess_cookie_name'] = 'cc_session';
$config['sess_expiration']  = 0;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']  = 'cc_sessions';
$config['sess_match_ip']    = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 3000000;

为什么sess_time_to_update设置得如此之高?起初,我以为是罪魁祸首,所以在5分钟后更新了会话,我已经将会话设置为记录到数据库中,并且记录了所有这些好东西。 e,问我问题,并帮助我深入了解这个问题!

Why is sess_time_to_update set so high? At first, I thought that was the culprit, updating the session after 5 minutes. I have set the session to record to a database, and all that good stuff. Please, ask me questions, and help me get to the bottom of this!

我应该指出,我在课程页面上有一个iFrame正在发送一个以此方式 ping回服务器...

I should point out that I have an iFrame that is on the course page that is sending a "ping" back to a server this way...

 <iframe id="timerAddEnd" style="display:none;" src="http://www.example.com/course/finish/<?=$course->intKey?>/ping" >
 </iframe>
 <script type="text/javascript">
      var auto_refresh = setInterval( function () 
      { 
           var iframe = document.getElementById('timerAddEnd'); 
           iframe.src = iframe.src; 
      }, 60000); 
      // refresh every minute 
 </script> 

这可能是罪魁祸首吗?我希望这将是对最初问题的快速而肮脏的修复。

Could THIS be the culprit? I was hoping this would be a quick and dirty fix to the initial problem.

推荐答案

您是否正在使用Firefox和Firebug及其扩展名(像FirePHP)安装?因为如果进行了这样的设置,则在打开/关闭Firebug控制台时,用户代理字符串会更改,并且您的会话将不再被CI识别。

Are you using Firefox and Firebug with extensions (like FirePHP) installed? Because if you are having such a setup, when you open/close the Firebug console, the user-agent string changes, and your session is no longer recognized by CI.

我的解决方法是禁用FirePHP。尝试检查您的用户代理字符串,看看您是否还有默认浏览器用户代理之外的其他功能。您应该能够轻松识别它。如果有的话。

My workaround was to disable FirePHP. Try checking your user-agent string and see if you have something extra besides the default browser user-agent. You should be able to identify it easily. if there is one.

这篇关于CodeIgniter破坏了我的会话而没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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