我使用“simplesoftwareio/simple-qrcode”生成了二维码:https://github.com/SimpleSoftwareIO/simple-qrcode
现在我想将生成的图像保存在我的本地驱动器中。我该怎么做?
public function qr($id)
{
$data = Ticket::get()->find($id);
$image = \QrCode::format('png')
->merge('img/t.jpg', 0.1, true)
->size(200)->errorCorrection('H')
->generate('A simple example of QR code!');
return response($image)->header('Content-type','image/png');
return view('qrCode', compact('qrData', $qrData));
}
最佳答案
你可以试试
$image = \QrCode::format('png')
->merge('img/t.jpg', 0.1, true)
->size(200)->errorCorrection('H')
->generate('A simple example of QR code!');
$output_file = '/img/qr-code/img-' . time() . '.png';
Storage::disk('local')->put($output_file, $image); //storage/app/public/img/qr-code/img-1557309130.png
关于php - 如何在 laravel 中保存生成的二维码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56037730/