json_decode to array

前端 未结 12 1486
野的像风
野的像风 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 02:07

    try this

    $json_string = 'http://www.domain.com/jsondata.json';
    $jsondata = file_get_contents($json_string);
    $obj = json_decode($jsondata,true);
    echo "
    ";
    print_r($obj);
    

提交回复
热议问题