【发布时间】:2016-09-01 11:14:35
【问题描述】:
我有一个从远程 Web 服务返回的 JSON 对象(通过 Curl 调用)。对象是这样的:
stdClass Object ( [https://example.com] => stdClass Object ( [hash] => 8 [id] => 277 ) )
我想如何从这个对象访问像:hash、id 这样的值?
我试过了:
$Object = json_decode( $curl_return );
echo $Object->hash; // Didn't work!
echo $Object[0]->hash; // Didn't work!
echo $Object[0]['hash']; // Didn't work!
echo $Object['https://example.com']->hash; // Didn't work!
请帮忙。
【问题讨论】:
-
还要确保不要忽略:stackoverflow.com/q/33157296/3933332,因为您在此处获得了无效的属性名称。