循环访问流表中的 FQL 结果
我正在使用 FQL 从 facebook 流表获取数据,但是,我在尝试循环数组以显示我需要的结果时遇到了一些麻烦。这是我正在使用的代码:
if ($user){
//fql query example using legacy method call and passing parameter
try{
$fql2 = "SELECT app_data
FROM stream
WHERE filter_key in (SELECT filter_key
FROM stream_filter
WHERE
uid=".$user."
AND type='newsfeed')
AND is_hidden = 0";
$param2 = array(
'method' => 'fql.query',
'query' => $fql2,
'callback' => ''
);
$fqlResult2 = $facebook->api($param2);
}
catch(Exception $o){
d($o);
}
}
for ($x=0; $x<200; $x++) {
d($fqlResult2[$x]['app_data']);
}
它返回这样的数组:
Array
(
[attachment_data] => {"name":"name in here",
"href":"url here",
"description":"desc here",
......etc}
)
我想要做的是从“attachment_data”获取值,例如名称、href...等等
有什么想法吗?
i am using FQL to get data from the facebook streams table, however, im having a little trouble trying to loop through the array to display results i need. here is the code i am using:
if ($user){
//fql query example using legacy method call and passing parameter
try{
$fql2 = "SELECT app_data
FROM stream
WHERE filter_key in (SELECT filter_key
FROM stream_filter
WHERE
uid=".$user."
AND type='newsfeed')
AND is_hidden = 0";
$param2 = array(
'method' => 'fql.query',
'query' => $fql2,
'callback' => ''
);
$fqlResult2 = $facebook->api($param2);
}
catch(Exception $o){
d($o);
}
}
for ($x=0; $x<200; $x++) {
d($fqlResult2[$x]['app_data']);
}
which returns arrays like this:
Array
(
[attachment_data] => {"name":"name in here",
"href":"url here",
"description":"desc here",
......etc}
)
what i want to do is get the values from the 'attachment_data', such as name, href...etc
any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是一个与 facebook 相关的问题...它是一个 php 问题...
您正在寻找 php 函数 - array_keys...
this is not a facebook related question... its a php question...
you are looking for the php function - array_keys...