我想以用户友好的方式显示来自 Facebook 的查询结果。
例如,我想显示照片而不是它的链接。
这是我的代码:
//fql query example using legacy method call and passing parameter
try{
$fql = "select name, hometown_location, sex, pic_square from user where uid=" . $user;
$param = array(
'method' => 'fql.query',
'query' => $fql,
'callback' => ''
);
$fqlResult = $facebook->api($param);
}
catch(Exception $o){
d($o);
}
当我这样做时print_r
,以下内容显示为:
FQL Query Example by calling Legacy API method "fql.query" Array ( [0] => Array ( [name] => Mohamed Abdelrahman [hometown_location] => [sex] => male [pic_square] => http://profile.ak.fbcdn.net/hprofile-ak-prn1/623888_100000415601915_463726603_q.jpg ) )
或者当我使用:
foreach ($fqlResult as $a => $b)
{
print "$a: $b\n";
}
它输出:
0: Array
感谢大家的回答,我自己解决了这个问题,这是解决方案
foreach($fqlResult as $inner_arr)
foreach($inner_arr as $value)
echo "$value<br/>";