码迷,mamicode.com
首页 > 微信 > 详细

php微信卡券logo上传方法

时间:2019-11-13 20:36:30      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:home   调用   ini   返回   形式   token   uem   微信   www   

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>

php微信卡券logo上传方法

标签:home   调用   ini   返回   形式   token   uem   微信   www   

原文地址:https://www.cnblogs.com/newmiracle/p/11852947.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!