codeIgnitor正在生成数据库中的多个会话。为什么? [英] CodeIgnitor is generating multiple sessions in the database. Why?
问题描述
我有一个网站,做页面加载一些Ajax调用。出于某种原因,codeIgnitor被插入4节(我假设为每个Ajax调用)作为加载页面。我存储会议在数据库中。
I have a site which does a few ajax calls on page load. For some reason, CodeIgnitor is inserting 4 sessions (I'm assuming one for each ajax call) as you load the page. I'm storing the sessions in the database.
我是pretty肯定应该只有每个浏览器一个会话。 Firefox的似乎只有一个生成;其他浏览器似乎创造了一大堆的会话。同一用户多个会话给我一些严重的身份验证问题。
I'm pretty sure there should only be one session per browser. Firefox seems to generate only one; other browsers seem to create a whole bunch of sessions. Multiple sessions for the same user are giving me some serious authentication problems.
这是怎么回事?我怎样才能阻止它?
Why is this happening? How can I stop it?
推荐答案
家伙
我认识的讨论是前一段时间,但有人可能会发现这个有用。
现在我用CI的会话没有存储在数据库中数据。今天,我决定试一试,并立即在同样的问题上运行:CI在每个页面加载生成新的会话
I know the discussion took place while ago, but somebody might find this useful. By now I've used CI session without storing its data in database. Today I decided to give it a try and immediately run across the same problem: CI was generating new session in every page load.
我检查了我的服务器时间,时区,我的饼干等 - 所有我能找到,因为在论坛上小费 - 没有结果。于是决定来调试CI Session类自己。
长话短说,事实证明,我的 USER_AGENT 字段在我的会话表太小了 - VARCHAR 50 - 这削减原有USER_AGENT字符串 - 因此CI没有找到我的会议,并生成onother之一。我只是增加了USER_AGENT字段大小为200,一切工作就像一个魅力。
I checked my server time, timezone, my cookie etc. - everything I could find as a tip on forums - with no result. Then decided to debug the CI Session class myself. Long story short, it turned out that my user_agent field in my session table was too small - VARCHAR 50 - which cuts the original user_agent string - hence CI doesn't find my session and generates onother one. I just increased the user_agent field size to 200 and everything works like a charm.
我忘了提,我使用的是Mac OS X Lion的。
I forgot to mention that I use Mac OS X Lion.
再次希望这能帮助别人。
Again, hope this will help somebody.
这篇关于codeIgnitor正在生成数据库中的多个会话。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!