json_decode to array

前端 未结 12 1333
野的像风
野的像风 2020-11-22 01:31

I am trying to decode a JSON string into an array but i get the following error.

Fatal error: Cannot use object of type stdClass as array in C:\\w

12条回答
  •  孤独总比滥情好
    2020-11-22 01:59

    json_decode($data, true); // Returns data in array format 
    
    json_decode($data); // Returns collections 
    

    So, If want an array than you can pass the second argument as 'true' in json_decode function.

提交回复
热议问题