php微信卡券logo上传方法
标签: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:phpStudyWWWmircowebmircowebwwwrootAppHomeController/../../../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.jmwww.net/weixin/15553.html
- 上一篇:小程序页面之间传值
- 下一篇:微信小程序 php 授权登陆,完整代码