function getImg(){
//配置APPID、APPSECRET
$APPID = "******"; //小程序appid
$APPSECRET = "*****";//小程序密钥
//调用微信接口获取access_token
$access_token = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$APPID&secret=$APPSECRET";
//http请求获取
$json = $this->httpRequest( $access_token );
$json = json_decode($json,true);
//保存token及响应时间
$_SESSION['access_token'] = $json['access_token'];
$_SESSION['expires_in'] = time()+7200;
$ACCESS_TOKEN = $json["access_token"];
//构建请求二维码参数
//path是扫描二维码跳转的小程序路径,可以带参数?id=xxx
//width是二维码宽度
//小程序码请求地址
$qcode ="https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=$ACCESS_TOKEN";
//小程序跳转页面及参数信息
PHP生成小程序码,保存到本地某路径下
于 2023-04-14 10:24:18 首次发布