在 config/app.php 注册serviceProvider
SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class
在 config/app.php 添加Facades
'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class
在Controller中引入
use SimpleSoftwareIO\QrCode\Facades\QrCode;
直接生成图片
$str = QrCode::size(300)->generate('Make me into a QrCode!');
将图片转成base64编码
$qrcode = base64_encode(QrCode::format('png')->size(300)->generate($encode));
相关资料
composer-simple-qrcode
github-simple-qrcode
Laravel中使用Simple Qrcode生成二维码
Class ‘QrCode’ not found Or add 'use SimpleSoftwareIO\QrCode\Facades\QrCode; '. If you wish to call it from your controller.