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?

    1 answer 1

    if php is lower than 5.4.0, then the error is understandable, upgrade your php to 5.4.0, this is the only solution

     Version Description 5.4.0 JSON_UNESCAPED_UNICODE options were added. 
    • Strange, 5.4.0 came out quite recently, and really, just noticed in the documentation. Thank! - chuikoff
    • but not for that, just read carefully about the parameters and versions. - Artem