不废话直接上代码
1.二维码业务类
<?php
/**
* User : 张纯泽
* Date : 2020/6/11
* Time : 9:20
*/
namespace app\api\service;
class Wxcode
{
public function getAccesstoken(){
$appid = ''; /*小程序appid*/
$srcret = ''; /*小程序秘钥*/
$tokenUrl="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$srcret;
$getArr=array();
$tokenArr=json_decode($this->send_post($tokenUrl,$getArr,"GET"));
$access_token=$tokenArr->access_token;
return $access_token;
}
public function send_post($url, $post_data,$method='POST') {
$postdata = http_build_query($post_data);
$options = array(
'http' => array(
'method' => $method, //or GET
'header' => 'Content-type:application/x-www-form-urlencoded',
'content' => $postdata,
'timeout' => 15 * 60 // 超时时间(

本文介绍了如何使用ThinkPHP框架开发微信小程序的带参数二维码生成业务,包括关键的业务类和实现方法,是小程序推广和分享的重要技术实践。
最低0.47元/天 解锁文章
3588

被折叠的 条评论
为什么被折叠?



