Use googleapi to generate a QR code business card example _ PHP Tutorial

Source: Internet
Author: User
Tags vcard
Use googleapi to generate a QR code business card example. Two-dimensional barcode can be divided into stacked two-dimensional barcode and matrix two-dimensional barcode. Stacked two-dimensional bar codes are stacked by one-dimensional code blocks with multiple lines. The two-dimensional bar codes of moment and two-dimensional codes of moment can be divided into two-dimensional stacked/row-arranged barcode and two-dimensional matrix barcode. Stacked/row-lined two-dimensional bar codes are stacked by one-dimensional bar codes with multiple lines of short cut; matrix two-dimensional bar codes are composed of matrices, in the corresponding element position of the matrix, "point" indicates the binary "1", and "null" indicates the binary "0", "point" and "null" to form the code.

Stacked/row-based two-dimensional bar codes, such as Code 16 K, Code 49, and Code 417.

Matrix qr code is the most popular one.

The matrix QR code stores a larger amount of data. it can contain numbers, characters, Chinese text, and other mixed content. it has a certain degree of fault tolerance (it can be read normally after some damages). It has a high space utilization rate.

The code is as follows:

$ Vname = 'test ';
$ Vtel = '000000 ';
GenerateQRfromGoogle ($ vname, $ vtel );

Function generateQRfromGoogle ($ vname, $ vtel, $ widhtHeight = '000000', $ EC_level = 'l', $ margin = '0 ')
{
If ($ vname & $ vtel ){
$ Chlorophyll = "BEGIN: VCARDnVERSION: 3.0". // vcard header information
"NFN: $ vname ".
"NTEL: $ vtel ".
"NEND: VCARD"; // vcard tail information
Echo '';
}
}
?>

Php generates the url qr code:

The code is as follows:
$ Url = "http://www.google.com.hk ";
GenerateQRfromGoogle ($ url );

Function generateQRfromGoogle ($ chlorophyll, $ widhtHeight = '000000', $ EC_level = 'l', $ margin = '0 ')
{
Echo '';
}
?>

Example


















































/** Generate a QR code business card in php* Api Google* Google api QR code generation [QRcode can store any text of a maximum of 4296 letters/numbers. for details, see the QR code data format]* @ Param string $ information contained in the chlorophyll QR code, which can be numbers, characters, binary information, and Chinese characters. The data type cannot be mixed and must pass through the UTF-8 URL-encoded. if the information to be passed exceeds 2 K bytes, use the POST method* @ Param int $ widhtHeight: set the size of the generated QR code* @ Param string $ EC_level: the error correction level is optional. the QR code supports four levels of error correction, which is used to restore lost, read, fuzzy, and data.* L-default: 7% of lost data can be identified.* M-identifies 15% of data loss* Q-identifies 25% of data loss* H-identifies 30% of data loss* @ Param int $ the distance between the QR code generated by margin and the image border* Qr code business card format --- vcard* The format is as follows:BEGIN: VCARDVERSION: 3.0FN: User nameTEL; CELL; VOICE: 0571-00000000TEL; WORK; VOICE: 0571-00000000TEL; WORK; FAX: 0571-00000000EMAIL; PREF; INTERNET: 361wayURL: http://www.111cn.netOrG: 361way O & M pathROLE: R & D departmentTITLE: CTOADR; WORK; POSTAL: XXX, Xihu district, Hangzhou; 310000REV: 2014-2-26T08: 30: 02ZEND: VCARDIf you want to customize the required format in more detail, you need to learn more about the format standard of vcard.*/$ Vcard = array ('Vname' => 'username ','Vtel' => '123 ','Vemail' => 'aaaaa @ 163.com ','Vaddress' => 'Hangzhou Xihu District ',);GenerateQRfromGoogle ($ vcard );Function generateQRfromGoogle ($ vcard, $ widhtHeight = '000000', $ EC_level = 'l', $ margin = '0 '){If ($ vcard ){$ Chlorophyll = "BEGIN: VCARDnVERSION: 3.0". // vcard header information"NFN:". $ vcard ['vname']."NTEL:". $ vcard ['vtele']."NEMAIL:". $ vcard ['vemail']."NADR:". $ vcard ['vaddress']."NEND: VCARD"; // vcard tail informationEcho '';}}?>
The code is as follows:

If you want to achieve the effect of a logo in the middle, you need to splice it with another logo thumbnail. Only one implementation method is provided here, and it can also be generated through QRcode.

For standard vcode information, see Wikipedia.

Note: Some generated images do not have scanned data because of encoding. this problem is common in windows. many editors provide ANSI encoding by default, change to utf8 and then OK.

Articles you may be interested in
  • Php generates QR code
  • Php QR code generation
  • PHP generates a QR code image with a LOGO
  • Simple php qr code generation instance
  • Php uses php qr Code to generate a QR Code (with logo)
  • Use phpqrcode to generate the QR code.

Bytes. Stacked/row-lined two-dimensional bar code is formed by stacking one-dimensional bar code with multiple lines and troughs. moment...

Related Article

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.