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

后端 未结 6 681
清歌不尽
清歌不尽 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条回答
  •  野的像风
    2021-02-02 14:55

    Ok I was running into the same issue. What I failed to notice is that I was using json_decode() instead of using json_encode() so for those who are going to come here please make sure you are using the right function, which is json_encode()

    Note: Depends on what you are working on but make sure you are using the right function.

提交回复
热议问题