PHP Dynamically generate QR code Library
Today, We want to share with you PHP Dynamically generate QR code Library.
In this post we will show you PHP QR Code -Dynamically generating a QR code with PHP, hear for How to generate QR code with logo easily in PHP automatically we will give you demo and example for implement.
In this post, we will learn about Dynamically generating a QR code with PHP with an example.
Don’t Miss : Dynamic QR Code Generator & Export PNG and SVG
How to generate QR code in PHP
In this post we will generate QR code (Quick Response Code) using php. QR code is used to read data with smart devices for easy.
Hear pass you uel and it will generate qr code of you url.
Welcome to the In Pakainfo.com website! You will Step By Step learn web programming, easy and very fun. This website allmost provides you with a complete web programming tutorial presented in an easy-to-follow manner. Each web programming tutorial has all the practical examples with web programming script and screenshots available.How to generate QR code in PHP
<?php // include QR Generator class include "QRGenerator.php"; // check for post method call. if($_SERVER["REQUEST_METHOD"] === "POST") { $set_url = $_POST['set_url']; $set_size = $_POST['set_size']; $example_1 = new QRGenerator($set_url,$set_size); $qr_img_1 = "generate().">"; $html_content =''; } else { $html_content =' '; $example_1 = new QRGenerator('http://pakainfo.org',100); $qr_img_1 = "generate().">"; $example_2 = new QRGenerator('https://in.yahoo.com/',100); $qr_img_2 = "generate().">"; $example_3 = new QRGenerator('https://www.google.com/',100,'ISO-8859-1'); $qr_img_3 = "generate().">"; $example_4 = new QRGenerator('https://www.bing.com',100,'ISO-8859-1'); $qr_img_4 = "generate().">"; $html_content .='
'.$qr_img_1.' | '.$qr_img_2.' |
'.$qr_img_3.' | '.$qr_img_4.' |
class of QRGenerator
qr_data = urlencode($qr_data); $this->qr_size = ($qr_size>80 && $qr_sizeqr_encoding = ($qr_encoding == 'Shift_JIS' || $qr_encoding == 'ISO-8859-1' || $qr_encoding == 'UTF-8') ? $qr_encoding : 'UTF-8'; $this->qr_errorCorrectionLevel = ($qr_errorCorrectionLevel == 'L' || $qr_errorCorrectionLevel == 'M' || $qr_errorCorrectionLevel == 'Q' || $qr_errorCorrectionLevel == 'H') ? $qr_errorCorrectionLevel : 'L'; $this->qr_marginInRows=($qr_marginInRows>0 && $qr_marginInRowsqr_debug = ($qr_debug==true)? true:false; } // function generate public function generate() { $QRLink = "https://chart.googleapis.com/chart?cht=qr&chs=".$this->qr_size."x".$this->qr_size. "&chl=" . $this->qr_data . "&choe=" . $this->qr_encoding . "&chld=" . $this->qr_errorCorrectionLevel . "|" . $this->qr_marginInRows; if ($this->qr_debug) { echo $QRLink; } return $QRLink; } } ?>