php微信卡券logo上传方法
<pre>
$xiangmupath = $this->getxiangmupath();
$logo = $xiangmupath . '/images/1/12.png';
$token = '19_bEfPNDgMAEAqTcb3uHFzv9wz0_STJ66nsfN1mux9owE_JQ9Bga527WLReM3fWI_1cUn0M1S4kMDW0gSDWWbyqDuEmLUZCiGuhCcBXP0AGRqTgAxghSoZF5c54KobtYL44E0NUERT_-P49qBEFGLaACAPQV';
$url = "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token={$token}";
// $logo = 'F:\phpStudy\WWW\mircoweb\mircoweb\wwwroot\App\Home\Controller/../../../Public/moban/images/1/12.png'; // 一定要图片的绝对路径
$file = '@'.$logo; // php5.6以后用到这个curlfile类
$arr['buffer'] = $file; // 文件的数据流
$arr['access_token'] = $token; // 调用接口凭证
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
//不需要验证ssl证书
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
//设置获取的信息以文件流的形式返回,而不是直接输出
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $arr);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
print_r(json_decode($output,'true'));
exit();
</pre>