官方文档:获取小程序码
以下是代码,直接可以用
<?php
namespace app\logic;
/**
* 图片二维码接口整合
*/
class qrcodeLogic
{
protected $wxAppID;
protected $wxAppSecret;
protected $wxAccessTokenUrl;
function __construct(){
$this->wxAppID = config('wx.app_id');
$this->wxAppSecret = config('wx.app_secret');
$this->wxAccessTokenUrl = sprintf(config('wx.access_token_url'),$this->wxAppID,$this->wxAppSecret);
}
// 获取二维码小程序
public function createQrcode($type = 'qrcode')
{
$path = input('path');
$scene = input('scene');
$result=curl_get($this->wxAccessTokenUrl);
//json_decode字符串变数组
$wxResult = json_decode($result,true);
if(empty($wxResult)){
return SuccessOrNot(false,200,[],['err'=>'获取acc

最低0.47元/天 解锁文章
1514

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



