zoukankan      html  css  js  c++  java
  • php微信卡券logo上传方法

    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>

  • 相关阅读:
    poj 1904 King's Quest
    【BZOJ】1051: [HAOI2006]受欢迎的牛
    hdu 2767 Proving Equivalences
    hdu 3234 Exclusive-OR
    poj 1988 Cube Stacking
    poj 1733 Parity game
    hdu 3047 Zjnu Stadium 带权并查集
    poj 1182 食物链 种类并查集
    HDU 3749 Financial Crisis
    【BZOJ】1046 : [HAOI2007]上升序列
  • 原文地址:https://www.cnblogs.com/newmiracle/p/11852947.html
Copyright © 2011-2022 走看看