PHP generates code for QR codes

Source: Internet
Author: User
Tags php class
Two-dimensional code is a two-dimensional barcode, can be the URL, text, photos and other information through the corresponding encoding algorithm compiled into a block-shaped barcode pattern, mobile phone users can use the camera and decryption software to re-decode the relevant information and view the content
PHP class library PHP QR Code
# Two words to explain:
# contains qrlib.php words need to be put together with other files: files, folders.
# phpqrcode.php is a merged version that only needs to contain this file, but the resulting picture is slow and less accurate
# Here are two ways to use:

<?php    include ('./phpqrcode/phpqrcode.php ');    Two-dimensional code data    $data = ' http://gz.altmi.com ';    The generated file name    $filename = $errorCorrectionLevel. ' | '. $matrixPointSize. " PNG ';    Error correction level: L, M, Q, H    $errorCorrectionLevel = ' L ';     The size of the point: 1 to    $matrixPointSize = 4;     QRCode::p ng ($data, $filename, $errorCorrectionLevel, $matrixPointSize, 2);? >  # Create a QR code file QRCode::p ng (' Code data text ', ' filename.png ');//creates file   # generate picture to browser QRCode::p ng (' some OT Hertext 1234 '); Creates code image and outputs it directly into browser

If you create a color, you need to do it yourself.
Modify the code in the Color Settings section of the Qrimage class in Phpqrcode.php, 1.1.4 version of the Code on the No. 987, 988 lines, a foreground color, a background color:

$col [0] = imagecolorallocate ($base _image,255,255,255); $col [1] = Imagecolorallocate ($base _image,0,0,0);

Can
Build with Google Open API

$urlToEncode = "http://gz.altmi.com"; Generateqrfromgoogle ($urlToEncode); function Generateqrfromgoogle ($chl, $widhtHeight = ' Max ', $EC _level= ' L ', $margin = ' 0 ') {     $url = UrlEncode ($url);      Echo '  '; }
  • 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.