Step-1. Firstly Download Xampp Server then go to c drive and open Xampp server folder then open htdocs doc folder then create a new folder with QRcode.
Step-2. Download QRCode library Referer URL: https://github.com/t0k4rt/phpqrcode
Step-3. After Download Extract zip file then copy Qrcode folder and paste inside xampp->htdoc->Qrcode folder.
Step-4. Outside the library, folder creates new file generate.php.
Step-5. Copy this code and paste generate.php then save.
<!doctype html>
<html>
<meta charset="utf-8">
<title>softwarequery.com</title><body>
<?php
include("qr/qrlib.php");
$nameOfImage = time().'.png';
QRcode::png("www.google.com",'QRImages/'.$nameOfImage,"H","10","10");
?>
<img src="<?php echo 'QRImages/'.$nameOfImage;?>" title="Image "/>
</body>
</html>
Step-6. Go to the browser then open new tab then type localhost/foldername/generate.php.
Step-7. If you want test Qrcode is working or not download code two Qr code desktop software.
Refer Url: https://www.codetwo.com/freeware/qr-code-desktop-reader/
Step-8. If you want to save Direct data in Qrcode create a new folder then make index.php file then copy this code and paste the index.php file.
<!DOCTYPE html>
<html>
<head>
<title>Qr code</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<textarea onkeyup="generate_qrcode(this.value)" cols="50" rows="5"></textarea>
<div id="result"></div>
</body>
<script>
function generate_qrcode(sample){
$.ajax({
type: 'post',
url: 'generator.php',
data : {sample:sample},
success: function(code){
$('#result').html(code);
}
});
}
</script>
</html>
Step-9. Create another Qr.php file then copy this code and paste Qr.php file.
<?php
$code = '<center><img src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl='.$_REQUEST['sample'].'" title="Link to Google.com"></center>';
echo $code;
?>
0 comments:
Post a comment