开发者

how to loop through the structure that facebook returns

so I'm writing a facebook app in PHP and I'm not really sure how to loop through and get the data out of what facebook returns. Here's an example where it only returns one:

object(st开发者_StackOverflow中文版dClass)#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"
    }
  }
}

Any ideas on how to loop through that and pull out the data in PHP? Thanks!


foreach ($object->data as $nested_object) {
    echo $nested_object->name;
    echo $nested_object->category;
    ...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜