用php qrcode生成二维码,怎么输出?
phpcn_u275
phpcn_u275 2017-03-21 17:22:51
0
2
1292
$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给前端?

phpcn_u275
phpcn_u275

reply all (2)
数据分析师

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);


      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!