二维码在线生成图片PHP源代码
二维码现在变得越来越流行了,这里介绍两端PHP的二维码生成代码,一段使用了Google开放的二维码API,另一段使用的是PHP QR Code二维码开源类库,都很简单。
1、使用Google Chart API生成二维码图片
Google Chart API是一个功能十分强大的API,生成二维码仅仅是其中的一个小功能。这里只介绍二维码部分,如果想了解更多功能,可以登录官网地址:http://code.google.com/intl/zh-CN/apis/chart/
代码如下:
$urlToEncode="http://www.weste.net";
generateQRfromGoogle($urlToEncode);
function generateQRfromGoogle($chl,$widhtHeight ='150',$EC_level='L',$margin='0')
{
$url = urlencode($url);
echo '';
}
?>
生成的二维码图片:
2、使用PHP QR Code生成二维码图片
PHP QR Code是一个开源的php二维码开源类库,基于libqrencode C库,并提供API代码创建QR条码图像,支持png、jpg格式。功能强大,使用起来也非常简单。
demo代码如下:
include "./phpqrcode/phpqrcode.php";
$value="http://www.weste.net";
$errorCorrectionLevel = "L";
$matrixPointSize = "4";
QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize);
exit;
?>
生成的二维码图片:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools
