Two-dimensional code is now becoming more and more popular, here is a description of both ends of PHP two-dimensional code generation code, a section of the use of Google-open two-dimensional Code API, another section using PHP QR code two-dimensional source class library, are very simple.
1, using Google Chart API to generate two-dimensional code picture
Google Chart API is a very powerful API, generating two-dimensional code is only one of the small functions. Here only the two-dimensional code section, if you want to know 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 = ' _level= ', $EC ' L ', $margin = ' 0 ')
{
$url = UrlEncode ($url);
Echo ';
}
?>
Generated two-dimensional code Picture:
2, use PHP QR code to generate two-dimensional code picture
PHP QR Code is an open source PHP two-dimensional code Open source class library, based on Libqrencode C library, and provides API code to create QR barcode images, support PNG, JPG format. Powerful and very simple 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 Picture: