PHP to generate two-dimensional code program code

Source: Internet
Author: User

The simplest and most examples of Goolge open source methods

1.google Open API

Cases

The code is as follows Copy Code

$urlToEncode = "http://gz.altmi.com";
Generateqrfromgoogle ($urlToEncode);
function Generateqrfromgoogle ($chl, $widhtHeight = ' _level= ', $EC ' L ', $margin = ' 0 ')
{
$url = UrlEncode ($url);
Echo '

Chs= '. $widhtHeight. ' x '. $widhtHeight. ' &cht=qr&chld= '. $EC _level. ' | ' $margin. ' &chl= '. $chl. ' "alt=" QR Code "

Widhtheight= "'. $size. '" widhtheight= "'. $size. '" /> ';
}

The above method is simple and fast, as long as a few words can be, the deficiency is called Google server things, if Google does not provide services we can not

Here we go, look at it.

2.php class library PHP QR Code

Address: http://phpqrcode.sourceforge.net/
Download: http://sourceforge.net/projects/phpqrcode/

Cases

  code is as follows copy code

<?php
   include ('./phpqrcode/phpqrcode.php ');
  //Two D code data
   $data = ' http://gz.altmi.com ';
  //generated filename
   $filename = $errorCorrectionLevel. ' | '. $matrixPointSize. ' PNG ';
  //Error correction level: L, M, Q, H
   $errorCorrectionLevel = ' l '; 
  //Point size: 1 to ten
   $matrixPointSize = 4; 
   qrcode::p ng ($data, $filename, $errorCorrectionLevel, $ Matrixpointsize, 2);
?

This is pretty good. Save in your own server, and now there are some such as: Libqrencode and QRCode Perl CGI & PHP Scripts Two-dimensional code generation plugin large

Home like also can see.

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.