How to generate QR Code in PHP
QR Code stands for Quick Response code. This is widely used in this world in a wider range of applications. By using this, we can replace a large amount of information, smart card data, consumer advertising, website url and much more into a two dimensional matrix barcode. This code is used to read data easily on smart devices. The data can be email, contact number, text, url etc.
In this article, we will learn how to generate QR code of a website URL using PHP in simple three steps.
PHP provides QR Code library to generate QR Code. Generating QR Code is very easy in PHP.
For this first download the QR Code library from the Github OR you can download from here -
Download and extract folder and place the extracted folder in your appropriate project directory where you want to execute. Now create a PHP file in the same folder where you placed the phpqrcode folder. Copy and paste the below code in your php file and replace the value in content variable.
<?php include "phpqrcode/qrlib.php" ; $content = "http://www.etutorialspoint.com/" ; QRcode::png($content) ; ?>
When you will execute the above code, you will get this QR Code.
So, this is the way to access a brand's website more quickly by QR code scanner rather than by manually entering a URL.
Related ArticlesPreventing Cross Site Request Forgeries(CSRF) in PHP
PHP code to send email using SMTP
Simple pagination in PHP
Simple PHP File Cache
PHP Connection and File Handling on FTP Server
Sending form data to an email using PHP
Recover forgot password using PHP and MySQL
How to display PDF file in PHP from database