Saturday, September 16, 2017

PHP QR Code Generator Script


Today I will share PHP script which will help you to generate the QR code.A QR code consists of black squares arranged in a square grid on a white background, which can be read by an imaging device such as a camera.The Script will create various QR code types like text, URLs, emails, etc. 

In this article we will see how we can generate the QR code from the text.

Steps Require to generate the QR code in PHP.

1. First of all we are using existing open source library, which helps us to generate QR Code easily without putting extra effort. This Library has few more functionalities you can use depending upon your use. To get more information about this Library you can visit to below URL and also you can download library files. 

http://phpqrcode.sourceforge.net/

2. After that we can create a code to generate QR Code with the help of library files.
QRCodeGenerate.php
<?php 

    include('qrlib.php'); 
     
    // outputs image directly into browser, as PNG stream 
    QRcode::png('PHP QR Code :)');

?>

Above code only generate the QR code.

3. we are not end with QR code scripting.To display the QR code in webpage we require the html image tag.
Example-1.php
<?php 

    // how to use image from example 001 
    echo '<img src="QRCodeGenerate.php" />';

?>

After all that final output is as follow :
Download Script : https://github.com/skptricks/php-Tutorials/blob/master/phpqrcode.rar

If you need any other information regarding that QR Code, Do comment in this post.


No comments:

Post a Comment