@阿狸的蚊子 我这个用的是laravel框架,用了easywechat
$wechat = app(‘wechat’);
/** @var \EasyWeChat\MiniProgram\MiniProgram $mini_program */
$mini_program = $wechat->mini_program;
$token = $mini_program->sns->getAccessToken()->getToken(true);
$scene = $request->get(‘scene’);
$page = $request->get(‘page’);
$data = "{
\“scene\” : \"{$scene}\",
\“page\” : \"{$page}\",
\“width\” : \“250\”
}";
$ch = curl_init(‘https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=’ . $token);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
之后的代码省略