public function school_list() { $where = array(); if ($area_id = intval($this->input->get('area_id'))) { $where['area_id'] = $area_id; } if ($city_id = intval($this->input->get('city_id'))) { $where['city_id'] = $city_id; } if ($school_property = intval($this->input->get('school_property'))) { $where['school_property'] = $school_property; } if ($keyword = trim($this->input->get('keyword'))) { $where['keyword'] = $keyword; } if ($grade_id = intval($this->input->get('grade_id'))) { $grade_period = get_grade_period($grade_id); if ($grade_period) { $where['grade_period'] = $grade_period; } } $schools = SchoolModel::search_school($where); echo json_encode($schools); }