Codeigniter login using session not working in iPad and other mobile browsers

前端 未结 2 886
闹比i
闹比i 2021-01-16 22:24

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

2条回答
  •  梦谈多话
    2021-01-16 23:10

    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.

    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;
    

    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.

    Let me know if it worked!

提交回复
热议问题