贴在墙上的照片-Facebook开放图-Php Sdk
如果相册“Wall Photos”存在,我想将图片发布到相册“Wall Photos”中,否则如果“Wall Photos”不存在,则在没有相册的情况下发布图像(APPNAME Photos)贴在墙上的照片-Facebook开放图-Php Sdk,php,facebook,sdk,Php,Facebook,Sdk,如果相册“Wall Photos”存在,我想将图片发布到相册“Wall Photos”中,否则如果“Wall Photos”不存在,则在没有相册的情况下发布图像(APPNAME Photos) 但是我收到了这个错误:在第1237行的base_facebook.php中抛出了无效的相册id。id字段应该是$album对象的一个元素。事实上,这是第一个 顺便说一句,您还应该使用BREAK命令,在满足条件时从foreach循环中退出 foreach($album['data'] as $album)
但是我收到了这个错误:在第1237行的base_facebook.php中抛出了无效的相册id。id字段应该是$album对象的一个元素。事实上,这是第一个 顺便说一句,您还应该使用BREAK命令,在满足条件时从foreach循环中退出
foreach($album['data'] as $album){
if($album['name'] == 'Wall Photos'){
// To debug:
echo "<pre>";
print_r($album);
echo "</pre>";
// End debug
$album_post = $album['id'];
break;
}
}
这至少会给你一个线索,告诉你发生了什么。@MohitBumb输出:[“姓名”]=>string(11)“墙上照片”[“封面照片”]=>string(15)“474591189233536”[“隐私”]=>string(6)“自定义”[“计数”]=>int(8)[“类型”]=>string(13)“朋友的墙壁”[“创建时间”]=>string(24)“2012-05-07T13:24:03+0000”[“updated_time”]=>string(24)“2012-10-12T11:18:05+0000”[“can_upload”]=>bool(false)}@MohitBumb以及如何获取id字段?
foreach($album['data'] as $album){
if($album['name'] == 'Wall Photos'){
// To debug:
echo "<pre>";
print_r($album);
echo "</pre>";
// End debug
$album_post = $album['id'];
break;
}
}
Array
(
[id] => xxxxxxxxxxxxxxx
[from] => Array
(
[category] => Community
[name] => xxxxxxxxxxxxx
[id] => xxxxxxxxxxxxx
)
[name] => xxxxxxxxxx
[description] => xxxxxxxxxxxxxxxx
[link] => http://www.facebook.com/album.php?xxxxxxxxxxxxxxxxxxxxxx
[cover_photo] => xxxxxxxxxxxxxx
[privacy] => everyone
[count] => 4
[type] => normal
[created_time] => 2012-12-11T14:56:06+0000
[updated_time] => 2012-12-11T14:56:22+0000
[can_upload] => 1
)