所以我用PHP写了一个facebook应用程序,我不确定如何循环并从facebook返回的数据中获取数据。这是一个只返回一个的例子:
object(stdClass)#1 (1) {
["data"]=>
array(1) {
[0]=>
object(stdClass)#2 (4) {
["name"]=>
string(28) "Naruto Shippuden Episode 216"
["access_token"]=>
string(97) "249129248435706|2f30355a536c4947ec32f522.1-1117572370|181703111883131|JYPPUX4rupaiWzJoZaD2r7jI1E4"
["category"]=>
string(7) "Tv show"
["id"]=>
string(15) "181703111883131"
}
}
}
关于如何循环并在PHP中提取数据的任何想法?谢谢!
答案 0 :(得分:1)
foreach ($object->data as $nested_object) {
echo $nested_object->name;
echo $nested_object->category;
...
}