codeigniter를 사용하고 있으며 사용자의 이름을 반환하는 함수를 만들었습니다. 여기에 코드입니다 :객체가 아닌 PHP 변수의 속성을 얻으려고 시도합니다.
$this->db->where('u_id', $id);
$query = $this->db->get('users');
$data = $query->result_array();
$string = $data->u_name.' '.$data->u_surname;
return $string;
내가이 오류를 얻을이 기능을 사용하고 있습니다 :
Message: Trying to get property of non-object and recall the line with $string = [...]
Generating Query Results 당신은 배열을 요청 ('[]')하지만 당신은 객체로 액세스하려는를 ('->') 그것은 작동 – Darren