Home>Article>Backend Development> How does PHP realize the generation and identification of QR codes (code)

How does PHP realize the generation and identification of QR codes (code)

不言
不言 Original
2018-08-18 17:44:33 22613browse

The content of this article is about how PHP realizes the generation and identification of QR codes (codes). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Recommended manual: php complete self-study manual

Classification of QR codes

  • linear stacked QR code

  • Matrix QR code

Advantages and disadvantages of QR code

Advantages

  • Large information capacity

  • Wide encoding range

  • Strong fault tolerance

  • High decoding reliability

  • Encryption measures can be introduced

  • Low cost and easy to produce

Disadvantages

  • QR code technology has become a new channel for the spread of mobile viruses and phishing websites

  • Information leakage

Three major international standards currently popular

  • PDF417: Does not support Chinese

  • DM: Unpublished patent , need to pay patent fees

  • QR CODE: patent disclosure, support Chinese

QR CODE error correction ability

  • L level: approximately 7% of the data codewords can be corrected

  • M level: approximately 15% of the data codewords can be error corrected

  • Q level: approximately 25% of the data codewords can be corrected

  • H level: approximately 30% of the data codewords can be error corrected

Prerequisite

  • GD library

1. PHP generates QR CODE

  • Official website: http://phpqrcode.sourceforge.net/

  • Download source code: https://github.com/endroid/qr-code

Directory structure

How does PHP realize the generation and identification of QR codes (code)

##1. qrcode_create.phpps: Generate ordinary QR code


      

2. qrcode_logo.phpps: Generate QR code with Logo


      

3. qrcode_vcard.php(Generate electronic signature)

  • vCard format: https://zh.wikipedia.org/wiki/VCard

  • 
          
Recommended related articles: 1.
Example of PHP generating WeChat QR code 2.
PHP URL conversion to generate QR code
Related video recommendations: 1.
Dugu Jiujian (4)_PHP video tutorial
2. JQUERY generates QR CODE

  • Source code address: https://github.com/jeromeetienne/jquery-qrcode

##jquery_create.php

  Jquery生成二维码  

3. PHP identification QR code

1. Method 1

Environmental requirements, install the following extensions- ImageMagick
- zbar
- php-zbarcode

2. Method 2

PHP recognizes QR codes (no need to install extensions). For preliminary testing, ordinary QR codes are OK. For QR codes with logo, the fault tolerance level needs to be set higher.qrReader class: https://github.com/baagee/php_QrReader

text(); //返回识别后的文本 echo $text;

Link: https://pan.baidu.com/s/1icpWRjIQiXdCXeOc52pNSg Password: c5y7

Related recommendations:

php uses open and fwrite to export files (code) in multiple formats

php implementation code for exporting Excel files in csv format

The above is the detailed content of How does PHP realize the generation and identification of QR codes (code). For more information, please follow other related articles on the PHP Chinese website!

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