codeigniter sess_destroy() not working properly,what m i doing wrong?

后端 未结 2 1341
北荒
北荒 2020-12-20 15:45

I am a newbie in codeigniter. I am using an an login form to login as an admin. When the admin logs in with the correct user name and password s/he is directed to the home p

2条回答
  •  自闭症患者
    2020-12-20 16:41

    If you logout then although the session is destroyed, the session userdata remains for the duration of the current CI page build.

    As a precautionary measure you should do:

    function log_out()
    {
        $this->session->sess_destroy();
        // null the session (just in case):
        $this->session->set_userdata(array('user_name' => '', 'is_logged_in' => ''));
    
        redirect('/admin/admin');
    }
    

    See: http://codeigniter.com/forums/viewthread/110993/P130/#662369

提交回复
热议问题