PHP generates two-dimensional code

Source: Internet
Author: User

A lot of online tutorials, but I did not introduce success, probably because to embed in the THINKPHP5, but still find a pro test available.

Baidu Cloud: Https://pan.baidu.com/s/1c2bapfM Password: lu5y

First of all:

Introduce files into your project

 use Phpqrcode\qrcode;
////Generate two-dimensional code    protected functionQRCode () {Loader:: Import ("Phpqrcode.phpqrcode",Extend_path); $value= "https://www.baidu.com/";//Two-dimensional code content        $errorCorrectionLevel= ' L ';//Fault tolerance level        $matrixPointSize= 5;//Generate picture size//Generate two-dimensional code picture Loader::import ("Phpqrcode.phpqrcode", Extend_path);        $value= "https://www.baidu.com/";//Two-dimensional code content        $errorCorrectionLevel= ' L ';//Fault tolerance level        $matrixPointSize= 5;//Generate picture size//Generate two-dimensional code picture        $filename= Root_path. ' Public '. Ds. ' uploads/'. Time().‘. png; QRCode::p ng ($value,$filename,$errorCorrectionLevel,$matrixPointSize, 2); $QR=$filename;//original two-dimensional code image file that has been generated        return $QR; }

All that is left is to call it directly. He generated a picture in PNG format.

If you want to save him to the database. You can save it locally or in the cloud first. Then get the link and then save the database.

Above

PHP generates two-dimensional code

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.