How to decode a json response from API

后端 未结 3 463
一向
一向 2021-01-29 06:47

I am calling data from an API like this:

$curl = curl_init();
//adding fields to the curl object to enter the site
curl_setopt($curl, CURLOPT_URL, $my_url);
curl         


        
3条回答
  •  被撕碎了的回忆
    2021-01-29 06:52

    Use json_decode(). If you want to view the php object so you can better understand how to use it, try

    echo '
    ';
    echo print_r(json_decode($jsonStr, true));
    echo '
    ';

提交回复
热议问题