我有一个简单的iPhone应用程序,我正在上传图片到Facebook。为此,我必须在服务器上放置多个文件。从此,它将转到Facebook。我有我的PHP代码下面,将做服务器端。数组中的变量(PHP)?
问题是,当我在数组中放置一个变量时,它不起作用。我尝试了所有不同的选项,但它并不适合我。
任何帮助表示赞赏!谢谢。
$args = array(
'message' => 'Photo from the ******** iPhone Application.',
'$short_url' => '$short_url'
);
$url = 'https://graph.facebook.com/'.$album_id.'/photos?access_token='.$get_facebook_token;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$data = curl_exec($ch);
//returns the photo id
print_r(json_decode($data,true));
好了,所有的报价看这里很好,你怎么得到的结果,而你到底在期待? – JakeSteam
这是什么? ''$ short_url'=>'@ $ short_url'' |试试''short_url'=> $ short_url'。单引号'''',不要内插。 – Orbling
你是对的。 @把我扔在那里。 – JakeSteam