사용자 ID를 기반으로 사용자 IP 주소를 얻고 싶습니다. 왜 작동하지 않는지 모르겠습니다.
컨트롤러에서 :
function block_user($name,$user_id)
{
$ip = $this->m_db->get_ips($user_id);
$data = array(
'username' => $name ,
'ip' => $ip ,
);
$this->db->insert('blacklist', $data);
$this->db->where('user_id',$user_id);
$this->db->delete('comments');
$this->index();
}
모델에서 :
function get_ips($user_id)
{
$this->db->select('ip');
$this->db->from('users');
$this->db->where('user_id',$user_id);
$query = $this->db->get();
return $query;
}
해야 할 일은 행을 반환하는 것입니다.
function get_ips($user_id)
{
$this->db->select('ip');
$this->db->from('users');
$this->db->where('user_id',$user_id);
$query = $this->db->get();
$ret = $query->row();
return $ret->ip;
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다