Home  >  Article  >  Backend Development  >  Example of using google api to generate QR code business card_PHP tutorial

Example of using google api to generate QR code business card_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:36:43870browse

Two-dimensional barcode/QR code can be divided into stacked/lined two-dimensional barcode and matrix two-dimensional barcode. The stacked/lined two-dimensional barcode is formed by stacking multiple rows of short one-dimensional barcodes; the matrix two-dimensional barcode is composed in the form of a matrix, and "dots" are used to represent binary "1" at the corresponding element positions of the matrix. ", using "empty" to represent binary "0", the arrangement of "dot" and "empty" constitutes the code.

Stacked/lined 2D barcodes, such as Code 16K, Code 49, PDF417, etc.

The most popular matrix QR code is QR CODE.

Matrix QR codes store a larger amount of data; they can contain mixed content such as numbers, characters, and Chinese text; they have a certain degree of fault tolerance (can be read normally after some damage); they have high space utilization, etc.

The code is as follows
 代码如下
 

$vname = 'test';
$vtel = '13800000000';
generateQRfromGoogle($vname,$vtel);

function generateQRfromGoogle($vname,$vtel,$widhtHeight ='150',$EC_level='L',$margin='0')
{
if($vname&&$vtel){
$chl = "BEGIN:VCARDnVERSION:3.0". //vcard头信息
"nFN:$vname".
"nTEL:$vtel".
"nEND:VCARD"; //vcard尾信息
echo 'QR code';
    }
}
?>

 

$vname = 'test';
$vtel = '13800000000';
generateQRfromGoogle($vname,$vtel);
代码如下
$url = "http://www.google.com.hk";
generateQRfromGoogle($url);

function generateQRfromGoogle($chl,$widhtHeight ='150',$EC_level='L',$margin='0')
{
echo 'QR code';
}
?> function generateQRfromGoogle($vname,$vtel,$widhtHeight ='150',$EC_level='L',$margin='0')
{
if($vname&&$vtel){
           $chl = "BEGIN:VCARDnVERSION:3.0". //vcard header information                                                                                              "; //vcard tail information
echo 'QR code';
}
}
?> php generates URL QR code:

The code is as follows
$url = "http://www.google.com.hk";
generateQRfromGoogle($url);<🎜> <🎜>function generateQRfromGoogle($chl,$widhtHeight ='150',$EC_level='L',$margin='0')
{
echo 'QR code';
}
?>

Example

 'vtel' => '13800000000',
 'vemail' => 'aaaaa@163.com',
 'vaddress' => '杭州市西湖区',
);
generateQRfromGoogle($vcard);
function generateQRfromGoogle($vcard,$widhtHeight ='150',$EC_level='L',$margin='0')
{
    if($vcard){
       $chl = "BEGIN:VCARDnVERSION:3.0". //vcard头信息
       "nFN:".$vcard['vname'].
       "nTEL:".$vcard['vtel'].
    "nEMAIL:".$vcard['vemail'].
    "nADR:".$vcard['vaddress'].
       "nEND:VCARD"; //vcard尾信息
       echo 'QR code';
    }
}
?>
 代码如下

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

For standard information on vcode, please refer to Wikipedia.

Note: Some generated pictures do not have data after scanning because of encoding. This problem is more common under windows. Since many editors provide ANSI encoding by default, changing it to utf8 is OK.

​ Articles you may be interested in
  • PHP generates QR code implementation code
  • PHP generates QR code program code
  • PHP generates QR code image with LOGO
  • Super simple PHP generated QR code example
  • php uses PHP QR Code to generate QR code (with logo)
  • Use phpqrcode to generate QR code example code

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/738513.htmlTechArticle Two-dimensional barcode/QR code can be divided into stacked/row-type 2D barcode and matrix 2D barcode barcode. Stacked/lined 2D barcodes are formed by stacking multiple lines of short 1D barcodes; rectangular...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn