how to update database table when session expired in codeigniter

爱⌒轻易说出口 提交于 2019-12-07 01:18:33

To do this you have to you have to extend CI_Session

Create a php file inside application/core/MY_Session.php

class MY_Session extends CI_Session {

public function __construct() {
    parent::__construct();
}

function sess_destroy() {

    //write your update here 
    $this->CI->db->update('YOUR_TABLE', array('YOUR_DATA'), array('YOUR_CONDITION'));

    //call the parent 
    parent::sess_destroy();
}

}

But it might not always work because your cookie might get expire so CI will not able to get your current session

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!