当前位置:首页 > 微信 > 正文

php微信卡券logo上传方法

11-25 微信

标签: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

博客主人杰米WWW
杰米博客,为大家提供seo以及it方面技巧喜欢的朋友收藏哦!
  • 11365文章总数
  • 2266821访问次数
  • 建站天数
  • 头条文章

    图文推荐

    站长推荐

    友情链接