構建Facebook視頻應用程序。用戶可以通過在app og.like中使用喜愛的視頻。顯示來自圖形API的[圖像] [url]
我用
$response = $facebook->api(
'me/og.likes',
'GET'
,我會得到
"data": {
"object": {
"id": "1399918593560042",
"url": "http://some_url.com",
"type": "video.tv_show",
"title": "the_video_title"
}
要獲得網址我使用。
$response = $facebook->api(
'me/og.likes?app_id_filter=381977341837631',
'GET'
);
foreach ($response['data'] as $data);
$Object = $data['data']['object'];
然後
<li class="program"><a class="thumbnail" data-transition="slide" href="<?php echo $Object['url']; ?>">
<img src="IMG_URL"></a></li>
的問題是,以顯示圖像。如果我點擊圖API中的ID,我將獲得
{
"id": "1399918593560042",
"url": "http://some_url.com",
"type": "video.tv_show",
"title": "the_video_title",
"image": [
{
"url": "https://v.redli.se/p/102/sp/10200/thumbnail/entry_id/0_53lzx39w/width/1024/height/720",
"secure_url": "https://v.redli.se/p/102/sp/10200/thumbnail/entry_id/0_53lzx39w/width/1024/height/720",
"type": "image/jpg",
"width": 1024,
"height": 576
}
我的問題是。我如何顯示圖像?
這很奇怪提取圖片的URL,他們把它稱爲「形象」,那麼數組中有1個對象,你可能需要另外一個foreach來獲得這個<?php foreach($ Object ['image'] as $ Image):?>Image<?php endforeach; ?> – ahmad
@ahmad有編輯我的代碼上面,看它現在的樣子。試圖獲得你寫的代碼,但似乎我得到的錯誤。任何想法 ? –