小程序码与小程序链接 / 小程序码 / 获取不限制的小程序码
$accessToken = $this->getAccessToken();
$url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={$accessToken}";
$data = [
'path' => 'pages/trim',
'check_path'=> false,
'env_version'=> 'trial',
'scene' => 'a=1',
'width' => $width
];
$data = array_merge($data, $optional);
// 新增调试输出
//var_dump('最终提交的参数:', $data);
$result = $this->httpPost($url, json_encode($data));
//var_dump('生成二维码返回的结果:', $result);
// 判断返回的是否是JSON错误信息
if (substr($result, 0, 2) === '{"') {
$error = json_decode($result, true);
print_r($error);
throw new Exception("获取小程序码失败: " . json_encode($error));
}
php代码,二维码生成后自定义的page不起作用,有没有人遇到过?

public function getUnlimitedCode($scene, $optional = []) {
$accessToken = $this->getAccessToken();
$url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={$accessToken}";
$data = [
'page' => 'pages/trim',
'scene' => $scene,
'check_path'=>false,
'env_version'=>'develop',
'width' => 1024
];
//$data = array_merge($data, $optional);
// 新增调试输出
//var_dump('最终提交的参数:', $data);
$result = $this->httpPost($url, json_encode($data));
//var_dump('生成二维码返回的结果:', $result);
// 判断返回的是否是JSON错误信息
if (substr($result, 0, 2) === '{"') {
$error = json_decode($result, true);
print_r($error);
throw new Exception("获取小程序码失败: " . json_encode($error));
}
return $result;
}
生成的二维码扫描的路劲还是不对。
文档中参数名是 page ,你传的是 path ?