我想以一種用戶友好的方式顯示來自Facebook的查詢結果。Facebook查詢結果顯示
例如,Ii想要顯示照片而不是鏈接。
這裏是我的代碼:
//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
感謝所有爲你的答案我已經解決了這個自己,這裏是soulation
foreach($fqlResult as $inner_arr)
foreach($inner_arr as $value)
echo "$value<br/>";
你當你的var_dump $ fqlResult在屏幕上什麼呢? –
'FQL Query Example by calling Legacy API method「fql.query」Array([0] => Array([name] => Mohamed Abdelrahman [hometown_location] => [sex] =>男性[pic_square] => http:/ /profile.ak.fbcdn.net/hprofile-ak-prn1/623888_100000415601915_463726603_q.jpg))' –