直接生成 svg
{{ QrCode::generate('Make me into a QrCode!'); }}
生成 png
<img src="https://img-blog.csdnimg.cn/2022010620540133024.png'png')->size(100)->generate('Make me into an QrCode!')); }} ">
如果用户需要保存图片的话,必须点击右键保存. 如何能够实时生成二维码图片并且直接下载
return response()->stream(function () {
echo QrCode::encoding('UTF-8')->format('png')->size(500)->generate('baidu.com');
}, 200, ["Content-type" => "image/png", "Content-Disposition" => "attachment; filename=" . 4512. ".png"]);