Good day! There is a simple function:
public function pages($category=0,$min=0,$max=10) { $this->db->select('id,title,showed'); $this->db->where('category',$category); $this->db->where('post_status','publish'); if($min>0) { $this->db->limit($min,$max); } else { $this->db->limit($max); } $query = $this->db->from('content')->get()->result_array(); foreach($query as $val){ $query = $this->load->module('cfcm')->connect_fields($val,'page'); } return json_encode($query,JSON_UNESCAPED_UNICODE); }
But for some reason, the second parameter in the json_encode function causes the problem:
A PHP Error was encountered
Severity: Warning
Message: json_encode () expects exactly 1 parameter, 2 given
Filename: get / get.php
Line Number: 52
Documentation 2 parameter is what is wrong?