Php generates a QR code image summary,
Method 1:
1. Method 1: use the most widely used and convenient Google api technology;
2
, <? Php // encapsulate the function (method) for generating a QR code image/* use google api to generate a QR code image $ content: QR code content parameter $ size: the size of the generated QR code, value of width and height $ lev: optional parameter, error correction level $ margin: distance from the generated QR code to the border */function create_erweima ($ content, $ size = '123 ', $ ROV = 'l', $ margin = '0') {$ content = urlencode ($ content); $ image = ''; return $ image ;}
3
/* Note: first construct the content string to call the function to generate * // construct the content string $ content = "public platform: Thinking and logic rn public account: siweiyuluoji "; // call the function to generate a QR code image echo create_erweima ($ content); // generate a QR code for the url; $ url = "http://jingyan.baidu.com/article/0964eca23c39ce8285f5363c.html"; $ url. = "rn"; $ url. = "http://jingyan.baidu.com/article/03b2f78c4d28ae5ea237ae15.html"; echo create_erweima ($ url);?>
Method 2:
1, the second way to use php class library php qr Code;: http://www.bkjia.com/codes/189897.html; or download on the official site: http://phpqrcode.sourceforge.net
2. Download and decompress the file, and copy (or copy) The phpqrcode folder to the project;
3
, <? Php // introduce the core library file include "phpqrcode/phpqrcode. php "; // defines the error correction level $ errorLevel =" L "; // defines the width and height of the generated image. The default value is 3 $ size =" 4 "; // define the generated content $ content = "public platform: Thinking and logic; public number: siweiyuluoji"; // call the static method of QRcode class. png generates a QR code image // QRcode :: png ($ content, false, $ errorLevel, $ size); // generate url type $ url = "http://jingyan.baidu.com/article/48a42057bff0d2a925250464.html"; $ url. = "rn"; $ url. = "http://jingyan.baidu.com/article/acf728fd22fae8f8e510a3d6.html"; $ url. = "rn"; $ url . = "Http://jingyan.baidu.com/article/92255446953d53851648f412.html"; QRcode: png ($ url, false, $ errorLevel, $ size);?>