search

Home  >  Q&A  >  body text

用php qrcode生成二维码,怎么输出?

   $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_u275phpcn_u2752836 days ago1358

reply all(2)I'll reply

  • 数据分析师

    数据分析师2017-10-01 01:04:48

    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.

    reply
    0
  • 阿神

    阿神2017-03-21 17:23:35

    首先你要知道,输出二维码是个图片,你要设置下header吧

    header('Content-type: image/jpeg');
    header('Content-Disposition: attachment; 
    filename=download_name.jpg');readfile($yourFilePath);


    reply
    0
  • Cancelreply