我只是打印Facebook API resonse如何遍历这个对象PHP
print_r($response)
输出
Facebook\GraphNodes\GraphEdge Object
(
[request:protected] => Facebook\FacebookRequest Object
(
[app:protected] => Facebook\FacebookApp Object
(
[id:protected] => secret
[secret:protected] => secret
)
[accessToken:protected] => secret
[method:protected] => GET
[endpoint:protected] => /search?q=co&type=page
[headers:protected] => Array
(
[Content-Type] => application/x-www-form-urlencoded
)
[params:protected] => Array
(
)
[files:protected] => Array
(
)
[eTag:protected] =>
[graphVersion:protected] => v2.5
)
[metaData:protected] => Array
(
[paging] => Array
(
[cursors] => Array
(
[before] => MAZDZD
[after] => MjQZD
)
[next] => https://graph.facebook.com/v2.8/search?access_token=EAAafvw8PPA4BACHY8V6GDpbzMbtRlZC7dZCRnOGtO26Yc4g4yWWvqZCsMBPOWO3b72n2JPjXP8KD91ZCMXMAcARGUsk5cNShhy5LxOmj0Gz4ZA2ESzPZAd4VzBCpdZATCZBvZCOkAIxBd1gXBzkMY0DheyjruSlMHEPbbuVuTY350wgZDZD&q=co&type=page&limit=25&after=MjQZD
)
)
[parentEdgeEndpoint:protected] =>
[subclassName:protected] =>
[items:protected] => Array
(
[0] => Facebook\GraphNodes\GraphNode Object
(
[items:protected] => Array
(
[name] => SC Corinthians Paulista
[id] => 132769576762243
)
)
[1] => Facebook\GraphNodes\GraphNode Object
(
[items:protected] => Array
(
[name] => Miranda Cosgrove
[id] => 9934379006
)
我想访问[items:protected]
阵列。但我不能找到如何让自己的
我试过
$ items_array = $ response-> items:protected;
但是,这是行不通的,请帮助我。我想获得该数组并重复它
无法访问受保护的数据类型 –
真的,没办法:
的线沿线的东西吗? @MASIDDIQUI – beginner
我想你可以使用简单的'foreach'迭代项目,如下所示:https://developers.facebook.com/docs/php/GraphEdge/5.0.0 –