获取Access_token
为了不暴露自动的AppId和AppSecret,我们要去向微信服务器要一个access_token 使用GET方法访问下面的网址:
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret;
$access = $http->request($url);
$access_token = json_decode($access,true);
$data1 = $access_token['access_token'];
$url1 = 'https://api.weixin.qq.com/wxa/getwxacode?access_token='.$data1;
$data['path'] = 绝对路径;
$share = https_request($url1,$data,'json');
header('content-type:image/jpeg');
echo $share;