美文网首页
php 获取带参数的二维码图片

php 获取带参数的二维码图片

作者: 原来是红灯啊 | 来源:发表于2019-08-07 16:11 被阅读0次

public function tests()
{
appid = 'wx8a0274bf1cb81dc3';secret = '0b1af8bd926d8d17945f9ceee7de7d0f';
ACCESS_TOKEN =this->getToken(appid,secret);
url =this->getTicket(ACCESS_TOKEN,'104'); p(url);
}
public function getToken(appid,secret)
{
ACCESS_TOKEN = file_get_contents("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=appid&secret=secret");ACCESS_TOKEN = json_decode(ACCESS_TOKEN);ACCESS_TOKEN = ACCESS_TOKEN->access_token; returnACCESS_TOKEN;
}
public function getTicket(token,uid)
{
url = 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token='.token;
data = [ 'expire_seconds' => 2592000,//30天,临时二维码最长有效时间 'action_name' => 'QR_SCENE',//临时型二维码 'action_info' => [ 'scene' => [ 'scene_id' => '158645' ] ] ];obj = this->post(url, data);url = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='.$obj->ticket.'';
return
}

相关文章

网友评论

      本文标题:php 获取带参数的二维码图片

      本文链接:https://www.haomeiwen.com/subject/ydnodctx.html