PHP Two-dimensional code generator
(1) Download the PHP QR code library on the official website, download the source files and extract them to the Phpqrcode directory.
(2) Create a script file create_png.php add the user form on the page with the following code:
<form method= "POST" >
Input text: <input type= "text" name= "info" ><br>
Please select size: <select name= ' Size ' >
<?
for ($i =1; $i <=10; $i + +) {//execute 10 cycles
if ($i ==4) {//default status is 4
echo "<option value=". $i. "' Selected> ". $i." </option> ";
}elese{
echo "<optionvalue=". $i. "' > ". $i." </option> ";
}
}
?>
</select>
<input type= "Submit" value= ' Generate and display ' id= ' input ' >
</form>
(3) Continue to add PHP operation code on the page as follows:
<?php
Inlcude_once ('.. /phpqrcode/qrlib.php '); Introducing the External class library
if ($_post[' info ')} {//Receive the value of the form
$temp = './images/'; Define the path of the two-dimensional code picture
$filename =time (). " Test.png "; Generate Picture Name
$filename = $temp. $filename; Build a full Catalog
QRCode::p ng ($_post[' info '), $filename, "L", $_post[' size ');//Create two-dimensional code based on parameters
echo " "; Show pictures
}
?>