控制器
$activity_session = array();
foreach($activities_by_category as $activity)
{
$activity_session[] = $this->users_model->search_sessions_by_activity($activity->activity_id);
}
模型
function search_sessions_by_activity($activity_id){
$this->db->where('activity_by_id',$activity_id);
$query = $this->db->get('activity_session');
return $query->result();
}
将json对象作为数组
答案 0 :(得分:0)
使用
更改模型 function search_sessions_by_activity($activity_id){
$this->db->where('activity_by_id',$activity_id);
$query = $this->db->get('activity_session');
return $query->result_array();
}
希望它能够正常运作。