我有一个php代码,调用facebook api me/home并获取此结果。但问题是不知道如何解码。所以我想在这里寻求帮助。指导我解码这个对象吗?
[1]=>
object(stdClass)#276 (9) {
["id"]=>
string(31) "100000000155611_312548192088517"
["from"]=>
object(stdClass)#275 (2) {
["name"]=>
string(13) "Jun Revistual"
["id"]=>
string(15) "100000000155611"
}
["message"]=>
string(95) "lifes interesting... if you stay alive, good things are bound to happen. :))
One Piece Movie 4"
["actions"]=>
array(2) {
[0]=>
object(stdClass)#274 (2) {
["name"]=>
string(7) "Comment"
["link"]=>
string(61) "http://www.facebook.com/100000000155611/posts/312548192088517"
}
[1]=>
object(stdClass)#273 (2) {
["name"]=>
string(4) "Like"
["link"]=>
string(61) "http://www.facebook.com/100000000155611/posts/312548192088517"
}
}
["type"]=>
string(6) "status"
["created_time"]=>
string(24) "2011-11-17T05:18:17+0000"
["updated_time"]=>
string(24) "2011-11-17T05:19:31+0000"
["likes"]=>
object(stdClass)#272 (2) {
["data"]=>
array(1) {
[0]=>
object(stdClass)#271 (2) {
["name"]=>
string(16) "Andrei Natividad"
["id"]=>
string(9) "614714754"
}
}
["count"]=>
int(1)
}
["comments"]=>
object(stdClass)#269 (2) {
["data"]=>
array(2) {
[0]=>
object(stdClass)#258 (4) {
["id"]=>
string(39) "100000000155611_312548192088517_4977358"
["from"]=>
object(stdClass)#267 (2) {
["name"]=>
string(16) "Andrei Natividad"
["id"]=>
string(9) "614714754"
}
["message"]=>
string(17) "what's the title?"
["created_time"]=>
string(24) "2011-11-17T05:18:45+0000"
}
[1]=>
object(stdClass)#260 (5) {
["id"]=>
string(39) "100000000155611_312548192088517_4977363"
["from"]=>
object(stdClass)#266 (2) {
["name"]=>
string(13) "Jun Revistual"
["id"]=>
string(15) "100000000155611"
}
["message"]=>
string(37) "One Piece Movie 4: Dead End Adventure"
["created_time"]=>
string(24) "2011-11-17T05:19:31+0000"
["likes"]=>
int(1)
}
}
["count"]=>
int(2)
}
}
到现在我还只是在这里:
foreach($wall as $value) {
echo "<pre>";
echo $value[0]->id;
print_r($value);
echo "</pre>";
}
甚至不知道这是否是正确的。
这看起来像它已经解码......你指的是解码? –
我相信你已经做对了,数据已经从json解码出来了,你正在以正确的方式访问它。 – Arfeen
我编辑了我的示例以获得更多的说明。我想要的是获得Jun Revistual的海报名称和他的消息,即“生活有趣......如果你......”。那些人在他的帖子中评论道。我想在我的脸书主页中构造它。 –