我正在使用Twitter API来解析std对象类。这是我的输出看起来像。我一直在使用json_decode和json_encode,但我一直在收到错误。如何访问元素?
stdClass Object ( [statuses] => Array ( ) [search_metadata] => stdClass Object ( [completed_in] => 0.006 [max_id] => 443759527804944385 [max_id_str] => 443759527804944385 [query] => hello+josh [refresh_url] => ?since_id=443759527804944385&q=hello%20josh&include_entities=1 [count] => 15 [since_id] => 0 [since_id_str] => 0 ) )
答案 0 :(得分:0)
使用->
访问对象属性,使用[]
访问数组元素。例如,它将是:
$object->statuses['search_metadata']->completed_in