PHP generates QRcode example
This article describes an example of php generating QRcode. Is a very useful function. Share it with everyone for your reference. The details are as follows:
The example demonstration effect is shown in the figure below:
The main function codes are as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
ini_set('display_errors', 'on');
$PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR;
$PNG_WEB_DIR = 'temp/';
include "qrlib.php"; // QRcode lib
$data = 'demo qrcode'; // data
$ecc = 'H'; // L-smallest, M, Q, H-best
$size = 10; // 1-50
$filename = $PNG_TEMP_DIR.'qrcode_'.time().'.png';
QRcode::png($data, $filename, $ecc, $size, 2);
chmod($filename, 0777);
echo '';
?>
|
1
2
3
4
5
6
7
8
9
10
11
1213
14
15
16
|
<🎜>ini_set('display_errors', 'on'); <🎜>
<🎜>$PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR; <🎜>
<🎜>$PNG_WEB_DIR = 'temp/'; <🎜>
<🎜> <🎜>
<🎜>include "qrlib.php"; // QRcode lib <🎜>
<🎜> <🎜>
<🎜>$data = 'demo qrcode'; // data <🎜>
<🎜>$ecc = 'H'; // L-smallest, M, Q, H-best <🎜>
<🎜>$size = 10; // 1-50 <🎜>
<🎜> <🎜>
<🎜>$filename = $PNG_TEMP_DIR.'qrcode_'.time().'.png'; <🎜>
<🎜>QRcode::png($data, $filename, $ecc, $size, 2); <🎜>
<🎜>chmod($filename, 0777); <🎜>
<🎜>echo '';
?>
|
http://www.bkjia.com/PHPjc/882701.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/882701.htmlTechArticlePHP generates QRcode example. This article tells the example of php generating QRcode. Is a very useful function. Share it with everyone for your reference. The details are as follows: The example demonstration effect is shown in the figure below...