我可以通过将 result() 更改为 result_array() 来消除第 29 行错误。但是 preg_match() 字符串问题仍然存在。
模型:
function get_room_details($data_room_type = array() ) {
$query = $this->db->query('SELECT rt_id, rt_name FROM room_type ORDER BY rt_name ASC');
$this->db->query($query);
if($query->num_rows()>0) {
foreach($query->result() as $row) {
$data_room_type[$row['rt_id']] = $row['rt_name'];
}
}
return $data_room_type;
echo "<pre>";
print_r($data_room_type);
echo "</pre>";
}
错误: