0

我有一个对象数组(显示在底部),可以通过以下方式访问数据:

echo $MyVariable->id;
echo $MyVariable->type;

等等。但是,我无法通过执行以下操作访问项目 [count]:

echo $MyVariable->id;

有人知道为什么吗?计数似乎用于其他用途,也许是计数?

  stdClass Object (
[id] => 573948779291487 
[from] => stdClass Object (
[category] => Bar 
[category_list] => Array (
[0] => stdClass Object (
[id] => 218693881483234 
[name] => Pub 
) 
[1] => stdClass Object (
[id] => 164049010316507 
[name] => Gastropub 
) ) 
[name] => The Melbourne Arms 
[id] => 533195070033525 
) 
[name] => The Melbourne Arms Gallery 
[location] => The Melbourne Arms 
[place] => stdClass Object (
[id] => 533195070033525 
[name] => The Melbourne Arms 
[location] => stdClass Object (
[street] => Main Street 
[city] => Melbourne 
[country] => United Kingdom 
[zip] => YO42 4QJ 
[latitude] => 53.8872441 
[longitude] => -0.8554097 
) ) 
[link] => http://www.facebook.com/album.php?fbid=573948779291487&id=533195070033525&aid=1073741825 
[cover_photo] => 573948812624817 
[count] => 28 
[type] => normal 
[created_time] => 2013-03-13T22:22:45+0000 
[updated_time] => 2013-03-13T22:34:40+0000 
[can_upload] => 
[likes] => stdClass Object (
[data] => Array (
[0] => stdClass Object (
[id] => 1361671776 
[name] => Lesley Maiden 
) 
[1] => stdClass Object (
[id] => 518580863 
[name] => Diane Maiden 
) 
[2] => stdClass Object (
[id] => 1254875611 
[name] => Vanessa Wilson 
) 
[3] => stdClass Object (
[id] => 533195070033525 
[name] => The Melbourne Arms 
) 
[4] => stdClass Object (
[id] => 100001664649752 
[name] => Bowen Lee 
) ) 
[paging] => stdClass Object (
[next] => https://graph.facebook.com/573948779291487/likes?limit=25&offset=25&__after_id=100001664649752 
) ) ) 1
4

1 回答 1

0

尝试以不同的方式处理您的数据

$data  = file_get_contents("https://graph.facebook.com/573948779291487");
$data = json_decode($data, true);
echo $data['count'];
于 2013-03-15T22:12:08.697 回答