Two-dimensional code online generation of images PHP source code _php Tutorial

Source: Internet
Author: User
Tags php source code

Two-dimensional code online generation of images PHP source code


QR code is now becoming more and more popular, here is the two-dimensional code generated by PHP code, a use of Google's open QR Code API, another section of the use of PHP QR code two-dimensional open source class library, are very simple.

1. Using Google Chart API to generate two-dimensional code images

Google Chart API is a very powerful API, the generation of QR code is just one of the small features. Here only the two-dimensional code section, if you want to learn more features, you can login to the official website address: http://code.google.com/intl/zh-CN/apis/chart/

The code is as follows:

  

$urlToEncode = "Http://www.weste.net";

Generateqrfromgoogle ($urlToEncode);

function Generateqrfromgoogle ($chl, $widhtHeight = ' Max ', $EC _level= ' L ', $margin = ' 0 ')

{

$url = UrlEncode ($url);

Echo ';

}

?>

Generated two-dimensional code image:

2. Using PHP QR code to generate two-dimensional code images

PHP QR Code is an open source PHP two-dimensional code open source class library, based on the Libqrencode C library, and provides API code to create QR barcode images, support PNG, JPG format. Powerful and easy to use.

The demo code is as follows:

  

Include "./phpqrcode/phpqrcode.php";

$value = "Http://www.weste.net";

$errorCorrectionLevel = "L";

$matrixPointSize = "4";

QRCode::p ng ($value, False, $errorCorrectionLevel, $matrixPointSize);

Exit

?>

Generated two-dimensional code image:

http://www.bkjia.com/PHPjc/834967.html www.bkjia.com true http://www.bkjia.com/PHPjc/834967.html techarticle Two-dimensional code on-line generation of images PHP source code QR Code is now becoming more and more popular, here is the two-dimensional code to introduce PHP code generation, a use of Google open QR Code API, another section ...

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