I’ve been playing with PHP QR Code all day and I can’t seem to get a QR code to actually print to screen. I’ve read through the documentation and I’ve tried a few different methods I found online but I just can’t get a QR code to output to the screen. Here’s the code I’m using per the instructions in the documentation:
<?php
header("Content-type: image/png");
include ("phpqrcode/qrlib.php");
QRcode::png('some othertext 1234');
?>
According to the documentation this code should output a QR code which would give the text inside the parentheses.
Have you set your headers so your browser knows to render the QR code as an image?
If you are setting your header (or phpqrcode does it for you, I can’t remember) but you’re not getting the image, see if you are getting any php errors or warnings that are inadvertently echoing out in the output stream, that will cause problems rendering your image. Ditto for any other chars you may be accidentally outputting.