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:<inputtype= "text" name= "info" ><br>
Please select size:<selectname= ' Size ' >
<?
for ($i =1; $i <=10; $i + +) {// perform ten cycles
if ($i ==4) {// default status is 4
echo "<optionvalue=". $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
}
?>
refuse to be a waste wood, I will do genius! receive PHP learning materials
PHP Two-dimensional code generator