[PHP] Code
- /*
- * PHP generates two-dimensional code card
- * API Google
- * Google API QR code generation "QRCode can store up to 4,296 alphanumeric types of arbitrary text, you can view the QR code data format"
- * @param string $chl QR code contains information, which can be numeric, character, binary information, Chinese characters. Data types cannot be mixed, and data must be UTF-8 url-encoded. If you need to pass more than 2K bytes of information, use the Post method
- * @param int $widhtHeight size setting for two-dimensional code generation
- * @param string $EC _level Optional error correction level, QR code supports four levels of error correction, used to recover lost, misread, blurred, data.
- * L-Default: Can identify lost 7% of the data
- * M-can identify data that has lost 15%
- * Q can identify data that has lost 25%
- * H can identify data that has lost 30%
- * @param int $margin The distance from the picture border generated by the two-dimensional code
- * Two-dimensional Code card format---vcard
- * Format reference 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: Chi-Wen Studio
- ROLE: Product Division
- Title:cto
- ADR; work; POSTAL: No. 35th North Four Ring road, Chaoyang District, Beijing 100101
- rev:2012-12-27t08:30:02z
- End:vcard
- If you want to customize the format in more detail, you need to know the format standard of the vcard in detail.
- */
- $vcard = Array (
- ' VName ' = ' user name ',
- ' Vtel ' = ' 13700000000 ',
- ' Vemail ' = ' playby@163.com ',
- ' Vaddress ' and ' Chaoyang District, Beijing ',
- );
- Generateqrfromgoogle ($vcard);
- function Generateqrfromgoogle ($vcard, $widhtHeight = ' Max ', $EC _level= ' L ', $margin = ' 0 ')
- {
- if ($vcard) {
- $chl = "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 ';
- }
- }
- ?>
Copy Code |