如何在编码器点火器中的会话自动过期时更新数据库



>我正在更新所有登录我网站的用户的登录和注销日期和时间,当他们在那个时候点击注销时,我正在保存该特定用户的注销时间,但是当会话自动过期时,我无法更新注销日期和时间。

要做到这一点,你必须扩展CI_Session

application/core/MY_Session.php内创建一个 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();
}
}

最新更新