Php generates QR Code business cards
[PHP] code
- /*
- * 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: VCARD
- VERSION: 3.0
- FN: User name
- TEL; CELL; VOICE: 15201280000
- TEL; WORK; VOICE: 010-62100000
- TEL; WORK; FAX: 010-62100001
- EMAIL; PREF; INTERNET: lzw # lzw. me
- URL: http://lzw.me
- OrG: Zhiwen Studio
- ROLE: Product Department
- TITLE: CTO
- ADR; WORK; POSTAL: No. 35, Beisihuan Middle Road, Chaoyang district, Beijing; 100101
- REV: 2012-12-27T08: 30: 02Z
- END: VCARD
- If 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' => 'playby @ 163.com ',
- 'Vaddress' => 'chaoyang district, Beijing ',
- );
- GenerateQRfromGoogle ($ vcard );
- Function generateQRfromGoogle ($ vcard, $ widhtHeight = '000000', $ EC_level = 'l', $ margin = '0 ')
- {
- If ($ vcard ){
- $ Chlorophyll = "BEGIN: VCARD \ nVERSION: 3.0". // vcard header information
- "\ NFN: '". $ vcard ['vname'].
- "\ NTEL:". $ vcard ['vtel'].
- "\ NEMAIL:". $ vcard ['vemail'].
- "\ NADR:". $ vcard ['vaddress'].
- "\ NEND: VCARD"; // vcard tail information
- Echo '';
- }
- }
- ?>
|
Php