我有这个代码
$graph_url = "https://graph.facebook.com/100000070848126/statuses?access_token=".$params['access_token'];
$status = json_decode(file_get_contents($graph_url),true);
echo $status->data->message;在如何在数组$status中输出数据时,我遇到了一个问题。我只是不知道如何调用此提要的项目
发布于 2013-01-06 07:57:14
json_decode()的第二个参数是是否创建关联数组。
json_decode ( string $json [, bool $assoc = false])
您指定您想要一个数组,所以您访问这些值的方式将如下所示-a array
echo $status['data']['message'];如果省略了json_decode()函数的true参数,您将能够以更面向对象的方式访问值,就像您的问题中的语法一样。
https://stackoverflow.com/questions/14177735
复制相似问题