Codeigniter登录使用会话不工作在iPad和其他移动浏览器 [英] Codeigniter login using session not working in iPad and other mobile browsers
问题描述
我可以在函数中获取登录和打印会话,但是当我点击任何其他功能我的会话丢失,它重定向我回到索引页,因为每个函数都有会话集约束。下面是代码:
I am able to get login and print session in the function but when i click on any other function my session get lost and it redirect me back to index page as each function is having session set constraint. Below written is the code:
$session = $this->session->userdata('logged_in');
redirect('user/user_dashboard');
当我打印会话时,它打印,删除后它失去了。
and when i print session over there it prints and after removing die it lost.
推荐答案
您是在测试Safari的浏览器吗?我发现很多报告,这是在iPad或iPhone上的Safari的常见问题,但也与Internet Explorer,我已经解决了过去。
Is the browser you're testing for Safari? I found a lot of reports that this is a common problem with Safari on iPad or iPhone, but also with Internet Explorer, which I've solved in the past.
当我在过去在Internet Explorer中遇到过这个问题,我通过在config.php中设置以下选项来修复它:
When I encountered this in the past on Internet Explorer, I fixed it by setting the following option in config.php:
$config['sess_match_useragent'] = FALSE;
显然,问题是由于每次用户加载时重新生成session_id任何页面。显然,CodeIgniter的本地会话类不再执行特定的检查。
Apparently, the problem is caused by the fact that the session_id() is regenerated every time a user loads any page. By not checking for the useragent any more, apparently, CodeIgniter's native session class no longer performs that particular check-up.
让我知道如果它工作!
这篇关于Codeigniter登录使用会话不工作在iPad和其他移动浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!