PHP访问jSON-错误-试图获取非对象的属性'amount_formatted'

时间:2019-04-04 17:41:09

标签: php json

我正在尝试访问json中的一些数据。这是我正在访问的json

enter image description here

我使用的代码是(由于不公开,因此我未发布网址或标头):

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);


//print_r($response);

$response = json_decode($response);

echo $response->host_transaction_stat->payout_transactions_total->amount_formatted;

我收到以下错误: enter image description here

如果我将回声更改为

echo $response->host_transaction_stat->user_id;

它带回了user_id字段,所以我知道我的curl正在正确地获取json。

0 个答案:

没有答案