Php generates a QR code image summary,

Source: Internet
Author: User

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);?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.