0
如何創建此類? 我的網站上的用戶可以上傳圖片到他們的FB頁面。 例如:myfbcover.com如何使用API在Facebook中創建相冊
我上傳了這些文件(https://github.com/facebook/php-sdk)。 現在接下來要做什麼? 請幫幫我!
如何創建此類? 我的網站上的用戶可以上傳圖片到他們的FB頁面。 例如:myfbcover.com如何使用API在Facebook中創建相冊
我上傳了這些文件(https://github.com/facebook/php-sdk)。 現在接下來要做什麼? 請幫幫我!
基本例如:
$facebook = new Facebook(array(
'appId' => 'APP_ID',
'secret' => 'APP_SECRET',
'cookie' => true,
));
$user = $facebook->getUser();
if ($user) {
$facebook->setFileUploadSupport(true);
//Create an album
$album_details = array(
'message'=> 'Album desc',
'name'=> 'Album name'
);
$create_album = $facebook->api('/me/albums', 'post', $album_details);
//Get album ID of the album you've just created
$album_uid = $create_album['id'];
//Upload a photo to album of ID...
$photo_details = array(
'message'=> 'Photo message'
);
$file='app.jpg'; //Example image file
$photo_details['image'] = '@' . realpath($file);
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
}
這僅僅是一個〔實施例。您可以在Google上找到很多來源。 希望它可以幫助您開始
我需要複製此代碼並粘貼到我的Index.php? 是否有之前的任何代碼 「$ Facebook的=新的Facebook(陣列( 」 爲頭文件,如 「reqiure(facebook.php)」 等? – 2012-02-19 08:37:43
require_once「Facebook的PHP-SDK-master'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR .'facebook.php'; $ 實=新的Facebook(陣列( 'APPID'=> '', '祕密'=> '', '文件上傳'=>真 )); .... – 2015-04-23 03:00:13
這是一個恥辱,這個答案沒有被選擇爲正確的...所以讓我們豎起大拇指 – Tanker 2017-06-08 19:22:22