本文作者:qiaoqingyi

二维码生成源码php(php二维码生成器)

qiaoqingyi 2023-03-10 559

本篇文章给大家谈谈二维码生成源码php,以及php二维码生成器对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

php生成二维码的几种方式整理及使用实例

本文整理了一些php生成二维码的方式:1.google开放api;2.php类库PHP QR Code;3.libqrencode;4.QRcode Perl CGI PHP scripts感兴趣的朋友可以参考下哈

1.google开放api

$urlToEncode="";

generateQRfromGoogle($urlToEncode);

function generateQRfromGoogle($chl,$widhtHeight ='150',$EC_level='L',$margin='0')

{

$url = urlencode($url);

echo 'img src="'.$widhtHeight.'x'.$widhtHeight.'cht=qrchld='.$EC_level.'|'.$margin.'chl='.$chl.'" alt="QR code" widhtHeight="'.$size.'" widhtHeight="'.$size.'"/';

}

2.php类库PHP QR Code

PHP QR Code is open source (LGPL) library for generating QR Code,

2-dimensional barcode. Based on libqrencode C library,

provides API for creating QR Code barcode images (PNG, JPEG thanks to GD2).

Implemented purely in PHP, with no external dependencies (except GD2 if needed).

?

include "./phpqrcode/phpqrcode.php";

$value="";

$errorCorrectionLevel = "L";

$matrixPointSize = "4";

QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize);

exit;

?

php 如何形成二维码

img src=";chld=chs=400x400chl=" /

这个代码就是利用谷歌的开放接口做的二维码,你也可以试试

如果需要完整版的话,我就给你写一个代码咯

html

head

meta charset="utf-8"

titlethe test page/title

script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"

/head

body

script

$(document).ready(function(){

    var test_input=$(".test_input").html();

    $("button").click(function(){

        $("p").after("img src=';chs=300x300chld=L|2chl="+test_input+"'");

    });

});

/script

input class="test_input" size="100"/input

brbr

buttonplease click it/button

p

fieldset

legend备注信息/legend

ol

    licht=qr 表示生成qr码(就是二维码)/li

    lichs=300x300 表示生成二维码图片的大小,可以自定义,但是一般是正方形的/li

    lichld=L|2 表示纠错水平,2表示留白大小,数值可选值为1、2、3、4级别/li

    lichl= 表示网址/li

/ol

/fieldset

/p

/body

/html

php生成二维码的几种方式

.altmi.com'; //生成的文件名$filename=$errorCorrectionLevel. '|'. $matrixPointSize. '.png'; //纠错级别:L、M、Q、H $errorCorrectionLevel='L'; //点的大小:1到10 $matrixPointSize=4;QRcode::png($data, $filename, $errorCorrectionLevel, $matrixPointSize,2); 官方给出的用例:?php#include这两个文件之一:/*qrlib.phpforfullversion(alsoyouhavetoprovidealllibraryfiles formpackagepluscachedir) ORphpqrcode.phpformergedversion(onlyonefile, butslowerandlessaccuratecodebecausedisabledcache andquickermaskingconfigured)*/#两句话解释: #包含qrlib.php的话需要同其它文件放到一起:文件、文件夹。 #phpqrcode.php是合并后版本,只需要包含这个文件,但生成的图片速度慢而且不太准确 #以下给出两种用法: #创建一个二维码文件QRcode::png('codedatatext', #生成图片到浏览器QRcode::png('someothertext1234');//createscodeimageandoutputsitdirectlyintobrowser

二维码生成源码php(php二维码生成器)

二维码生成源码php的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于php二维码生成器、二维码生成源码php的信息别忘了在本站进行查找喔。

阅读
分享