简体   繁体   English

PHP会话仅在CodeIgniter IE中丢失

[英]PHP Session lost in CodeIgniter IE only

I'm losting the session with CodeIgniter and only in Internet Explorer 我丢失了与CodeIgniter的会话,仅在Internet Explorer中丢失了

I send an AJAX request to my first controller: 我向我的第一个控制器发送AJAX请求:

/controller/method1 /控制器/方法1

In this method1, I create my session 在这种方法中,我创建了我的会话

$this->session->set_userdata('user', 1);

I send a second AJAX request 5 seconds after the first, to another method: 我在第一个请求发送5秒后,向另一个方法发送了第二个AJAX请求:

/controller/method2 /控制器/ method2

In this method, I try to show the content of the session user 在这种方法中,我尝试显示会话用户的内容

var_dump($this->session->userdata('user'));

But I got a bool(false) answer. 但是我得到了一个布尔(假)答案。

For information, the session library is autoloaded. 有关信息,会话库是自动加载的。 In Chrome, that works good. 在Chrome中,效果很好。

Do you have any idea to solve this problem? 您有解决这个问题的想法吗?

Thanks 谢谢

更改'sess_cookie_name'从配置'ci_session''cisession'sess_expiration从7200到84200。

My solution is similar to @sachin-prasad's answer. 我的解决方案类似于@ sachin-prasad的答案。 Only removing the underscore of the sess_cookie_name value will not work. 仅删除sess_cookie_name值的下划线将不起作用。 You need to increase the sess_expiration as well. 您还需要增加sess_expiration

I tested it in IE 11 and the session works fine. 我在IE 11中对其进行了测试,会话工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM