Using Google API to generate two-dimensional Code business card Example _php tutorial

Source: Internet
Author: User
Tags vcard
Two-dimensional barcode/Two-D code can be divided into stacked/row-type two-dimensional barcode and matrix two-dimensional barcode. Stacked/row-type two-dimensional barcode form is composed of a multi-line short-cut one-dimensional bar code stacked, matrix-type two-dimensional bar code in the form of a matrix, the corresponding element position in the matrix with "point" for the binary "1", with "empty" means binary "0", "point" and "empty" the arrangement of

Stacked/row-type two-dimensional barcode, such as code 16K, code 49, PDF417, etc.

Matrix-type QR code, the most popular is the code.

Matrix QR Code stores more data, can contain mixed content such as numbers, characters, and Chinese text, and has certain fault tolerance (which can be read normally after partial damage) and high space utilization.

$vname = ' Test ';
$vtel = ' 13800000000 ';
Generateqrfromgoogle ($vname, $vtel);

function Generateqrfromgoogle ($vname, $vtel, $widhtHeight = ' Max ', $EC _level= ' L ', $margin = ' 0 ')
{
if ($vname && $vtel) {
$chl = "begin:vcardnversion:3.0". vcard Header information
"NFN: $vname".
"NTEL: $vtel".
"Nend:vcard"; vcard Tail Information
Echo ';
}
}
?>

< td="">
The code is as follows

PHP generated URL qr code:

function Generateqrfromgoogle ($chl, $widhtHeight = ' Max ', $EC _level= ' L ', $margin = ' 0 ')
{
Echo ';
}
?>

$url = "http://www.google.com.hk";
Generateqrfromgoogle ($url);

< td="">
The code is as follows

Example


















































< td=""> /** 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: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 Road of operation and maintenanceROLE: Research and Development DepartmentTitle:ctoADR; work; POSTAL: West L. District xxx, Hangzhou, 310000rev:2014-2-26t08:30:02zEnd:vcardIf 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 ' = ' 13800000000 ',' Vemail ' = ' aaaaa@163.com ',' Vaddress ' and ' Hangzhou city West L. District ',);Generateqrfromgoogle ($vcard);function Generateqrfromgoogle ($vcard, $widhtHeight = ' Max ', $EC _level= ' L ', $margin = ' 0 '){if ($vcard) {$chl = "begin:vcardnversion:3.0". vcard Header information"NFN:". $vcard [' VName ']."NTEL:". $vcard [' Vtel ']."Nemail:". $vcard [' Vemail ']."Nadr:". $vcard [' vaddress ']."Nend:vcard"; vcard Tail InformationEcho ';}}?>
The code is as follows
<>

If you want to achieve the logo in the middle of the effect, you need to use another logo to join the small image. Only one implementation is available here, or it can be generated in a qrcode way.

Vcode's standard information can be see Wikipedia.

Note: Some of the generated pictures are scanned for data that is caused by encoding, which is more common under Windows, because many editors provide ANSI encoding by default, and changing to UTF8 is OK.

Articles you may be interested in
    • PHP generates code for QR codes
    • PHP generates QR Code program code
    • PHP generates two-dimensional code image with logo
    • Ultra-simple PHP generation of two-dimensional code instances
    • PHP uses PHP QR code to generate two-dimensional code (with logo)
    • Using Phpqrcode to generate two-dimensional code instance code

http://www.bkjia.com/PHPjc/738513.html www.bkjia.com true http://www.bkjia.com/PHPjc/738513.html techarticle Two-dimensional barcode/Two-D code can be divided into stacked/row-type two-dimensional barcode and matrix two-dimensional barcode. Stacked/row-type two-dimensional barcode form is a multi-line short-cut one-dimensional barcode stacking;

  • 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.