json_decode() expects parameter 1 to be string, array given

后端 未结 6 692
清歌不尽
清歌不尽 2021-02-02 14:15

What causes this error in my code?

$query = $this->db->query(\"SELECT * FROM tour_foreign ORDER BY id desc\");
        $data = array();
        foreach ($q         


        
6条回答
  •  旧时难觅i
    2021-02-02 14:48

    json_decode() is used to decode a json string to an array/data object. json_encode() creates a json string from an array or data. You are using the wrong function my friend, try json_encode();

提交回复
热议问题