关键词搜索

全站搜索
×
密码登录在这里
×
注册会员

已有账号? 请点击

忘记密码

已有账号? 请点击

使用其他方式登录

EasyWeChat动态base64获取小程序二维码图片

发布2021-04-23 浏览1971次

详情内容

EasyWeChat动态base64获取小程序二维码图片,不存在二维码为图片到路下,

$response = $app->app_code->getQrCode('/path/to/page');

// $response 成功时为 EasyWeChat\Kernel\Http\StreamResponse 实例,失败为数组或你指定的 API 返回类型

// 保存小程序码到文件
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
    $filename = $response->save('/path/to/directory');
}

// 或
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
    $filename = $response->saveAs('/path/to/directory', 'appcode.png');
}

以下方便是直接动态取二维码图片数据流

$app = Factory::miniProgram($config);
$response = $app->app_code->getUnlimit('jianxiu', [
    'page'  => 'pages/user/user',
]);
//print_r($response);

$img = $response->getBody()->getContents();//获取图片二进制流
$img_base64 = 'data:image/png;base64,' .base64_encode($img);//转化base64


点击QQ咨询
开通会员
上传资源赚钱
返回顶部
×
  • 微信支付
  • 支付宝付款
扫码支付
微信扫码支付
请使用微信描二维码支付
×

提示信息

×

选择支付方式

  • 微信支付
  • 支付宝付款
确定支付下载