chentailin
public function get_forever_media(){
        $access_token = $this->getAccessToken();
        $url = \'https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=\'.$access_token;
        $filepath = getcwd().\'/data/members/virtual/20180711/50566e59d1145ceac73d47d19ec70a10.jpg\';
        $path = new CURLFile(realpath($filepath));
        $type = \'image\';
        //$url = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token=$access_token&type=$type";
        $ch1 = curl_init ();
        $data= array(\'media\'=>$path);
        curl_setopt($ch1, CURLOPT_URL, $url);
        curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, FALSE);
        if (!empty($data)){
            curl_setopt($ch1, CURLOPT_POST, 1);
            curl_setopt($ch1, CURLOPT_POSTFIELDS, $data);
        }
        curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
        $result = curl_exec ( $ch1 );
        curl_close ( $ch1 );
        return $result;
    }

 

分类:

技术点:

相关文章:

  • 2021-09-30
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-02-07
  • 2022-02-07
  • 2021-11-17
猜你喜欢
  • 2021-07-13
  • 2021-12-06
  • 2021-12-01
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
相关资源
相似解决方案