Codeigniter session will not unset

前端 未结 2 1690
北海茫月
北海茫月 2021-01-27 09:08

im working on a community, and i want to user to log off but it dosent unset the userdata :S, do you know why?

this is my controller function

function lo         


        
相关标签:
2条回答
  • 2021-01-27 10:01

    You can destroy an entire session by calling the following:

    $this->session->sess_destroy();
    
    0 讨论(0)
  • 2021-01-27 10:03

    You need to specify what elements you want to unset individually rather than a variable or object as per your code:

    $this->session->unset_userdata($sessionData);
    

    Instead use to remove the login information so you still preserve a basket or whatever else you have stored:

    $this->session->unset_userdata('userid');
    

    Or destroy the whole session:

    $this->session->sess_destroy();  //as per Yorick's answer
    
    0 讨论(0)
提交回复
热议问题