84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
$data = 'www.baidu.com'; include 'phpqrcode.php'; $QRcode = new \QRcode(); ob_start(); $QRcode->png($data); $imageString = base64_encode(ob_get_contents()); ob_end_clean(); echo $imageString;
为什么上面的代码没有输出,要在php里直接生成二维码转base给前端?
Use php qrcode to generate a QR code, how to output it? -PHP Chinese website Q&A-Use php qrcode to generate QR code, how to output it? -PHP Chinese website Q&A
Let’s take a look and learn.
首先你要知道,输出二维码是个图片,你要设置下header吧
header('Content-type: image/jpeg'); header('Content-Disposition: attachment; filename=download_name.jpg');readfile($yourFilePath);
Use php qrcode to generate a QR code, how to output it? -PHP Chinese website Q&A-Use php qrcode to generate QR code, how to output it? -PHP Chinese website Q&A
Let’s take a look and learn.
首先你要知道,输出二维码是个图片,你要设置下header吧