[英]How can I get the id and ip_address and add one more column user_id in ci_session table in Codeigniter and add one
$this->session->session_id
to get the session id. 您可以使用$this->session->session_id
来获取会话ID。 $this->session->set_userdata('user_id','value');
您可以使用$this->session->set_userdata('user_id','value');
to save value
into user_id
column, and $this->session->userdata('user_id');
将value
保存到user_id
列和$this->session->userdata('user_id');
to retrieve that value
. 检索该value
。 Edit 编辑
If you still want to update the table column, you could using the old way : 如果仍然要更新表列,则可以使用旧方法:
$this->db->where('id', session_id());
$this->db->update($this->config->item('sess_save_path'), array('user_id'=>'1111'));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.