Use your previous code and do no echo anything out inside the image. QR Code can be used for many things other than sharing URL links – Email addresses, telephone numbers, SMS, VCards, Tweet, open an app (deep link), and so much more. You can't put text like that inside an image, it will make it malformed/corrupted and not display. Lastly, just in case you have missed this one. Not going to explain line-by-line, this should be pretty self-explanatory – We can also set various options, add a logo, and even set a label on the QR code. $result = $writer->write($qr, $logo, $label) Based on libqrencode C library, provides API for creating QR Code. >setForegroundColor(new Color(0, 0, 255)) PHP QR Code is open source (LGPL) library for generating QR Code, 2-dimensional barcode. Lastly, getDataUri() outputs the data URI string, for you guys who want to “directly embed” the image on the page itself getDataUri()}'/>.Ģ-options.php setErrorCorrectionLevel(new ErrorCorrectionLevelHigh()).Good for you guys who want to generate unique discounts or tracking codes for users, just point an image tag to the QR Code PHP. getString() directly outputs the QR code in the raw data string.saveToFile() saves the QR code into an image file on the server.Output the QR code, the library offers 3 different “modes” of output:.
Using the library to create a QR code is straightforward as A-B-C: