我已經從朋友列表中返回結果,但是我希望那裏只有返回的名字而不是全名。使用圖形API顯示姓氏。可能嗎?
這是可能的。
另外,我怎樣才能使配置文件圖像更大時顯示?
我嘗試過使用「first_name」,但是作爲Undifined索引返回。
這裏是我的代碼有:
if ($user) {
$user_profile = $facebook->api('/me');
$friends = $facebook->api('/me/friends');
echo '<table>';
foreach ($friends["data"] as $value) {
echo '<td>';
echo '<div class="pic">';
echo '<img src="https://graph.facebook.com/' . $value["id"] . '/picture"/>';
echo '</div>';
echo '<font color="white">','<div class="picName">'.$value["first_name"].'</div>','</font>';
echo '</td>';
}
echo '</table>';
}
也許你必須解析的名字,因爲api只返回全名。它可能不是很難解析,尤其是如果你使用正則表達式..... – BigBug 2013-05-13 21:36:26