Session lost after redirect in Codeigniter

前端 未结 13 2429
清歌不尽
清歌不尽 2021-02-05 06:39

I\'m using codeigniter as a framework.

Firstly, I use localhost but when I change to my IP address the login function doesn\'t work anymore. I found that th

13条回答
  •  名媛妹妹
    2021-02-05 06:58

    I was shocked at first when I encountered this problem. It happened to me because my session data had an @ sign.

    The solution is to simply encode the data using base64_encode.

    Eg:

    $Data = urlencode(  base64_encode($Email) );
    $this->session->set_userdata('Data', $Data);
    

    And to reuse it, simply do this:

    $Data = base64_decode( urldecode( $this->session->userdata('Data') ) );
    

    Hope this helps.

    NEW FINDING: This problem still persists on some browsers and devices. So this is not really a solution anymore. For example, it works on Samsung Android, MicroMAX Android but not on Huawei Android.

提交回复
热议问题