难点是请求https://api.weixin.qq.com/wxa/getwxacodeunlimit ,
的时候请求方式是raw,第二,由于返回的是图片的数据,因此,直接把返回的数据写进文件中就可以。
$appid = '';//
$secret='';
$sendurl="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret;
$return =$this->http_get($sendurl1) ;
$data=json_decode($return,true);
$pic=$this->http_postraw("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=".$data['access_token'],$user['id']) ;
$jpg = 'D://WWW/eschool/imgpublic/wxappshare_'.$data1['unionId'].'.jpg';
ob_end_clean(); //清空缓冲区
$fp = fopen($jpg,'w'); //写入图片
if(fwrite($fp,$pic))
{
fclose($fp);
}
/**
* POST 请求
* @param string $url
* @par