I used the github php qrcode library. I can generate the qr code with no problem. How ever if the generate it and echo some words then the qr code scrambled.
My code is as follow:
<?php
include "phpqrcode/qrlib.php";
$link = "http://mail.gmail.com";
echo "ABC";
QRcode::png($link);
?>
if I comment the echo "ABC", the qr code is fine. Why this happened?
The png function creates the image and streams its file contents to the browser directly. Echoing data in between is like editing the image in Notepad and inserting random data, thus corrupting the image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With