是否可以发布图像并链接在一起?这是我的代码:
try {
$facebook->setFileUploadSupport(true);
if(!isset($userLink)){
$postResult = $facebook->api(
'/'.$userGroupId.'/photos/',
'post',
array(
'message' => $userMessage,
'source' => '@'.$_FILES["source"]["tmp_name"] ));
}else{
$postResult = $facebook->api(
'/'.$userGroupId.'/photos/',
'post',
array(
'message' => $userMessage,
'link' => $userLink,
'source' => '@'.$_FILES["source"]["tmp_name"] ));
}
}
catch (FacebookApiException $e) {
error_log('Could not post image to Facebook.');
}
没有'link'
一切都很好,但是如果我将链接插入数组,我会收到错误:Notice: Undefined variable: postResult in..
我的代码有问题吗?请帮忙,谢谢。
如果您阅读文档,链接参数是-
Facebook上照片的链接(您希望上传)
但是您正在以另一种方式使用它,以与照片一起共享链接 - 这是不可能的。要在墙上共享链接,您必须改用Feed。