发表时间:2014-09-05来源:网络
<?php /** * php生成二维码的2种方式 * @author insun */ //1.google开放api $urlToEncode="smart_insun"; generateQRfromGoogle($urlToEncode); function generateQRfromGoogle($chl,$widhtHeight ='150',$EC_level='L',$margin='0') { //$url = urlencode($url); echo '<img src="http://chart.apis.google.com/chart?chs='.$widhtHeight.'x'.$widhtHeight.'&cht=qr&chld='.$EC_level.'|'.$margin.'&chl='.$chl.'" alt="QR code" widhtHeight="'.$widhtHeight.'" widhtHeight="'.$widhtHeight.'"/>'; } //2.php类库PHP QR Code:http://phpqrcode.sourceforge.net/ /* $data 数据 $filename 保存的图片名称 $errorCorrectionLevel 错误处理级别 $matrixPointSize 每个黑点的像素 $margin 图片外围的白色边框像素 */ include "phpqrcode/qrlib.php"; $data = "insun"; $filename ="QR.jpg"; $errorCorrectionLevel = 'L'; $matrixPointSize = 2; $margin = 5; QRcode::png($data, $filename, $errorCorrectionLevel, $matrixPointSize, $margin);//这样就生成了QR.jpg

QR图片中间加logo
<?php /** * QR Code + Logo Generator QR图片中间加logo,QR是根据google开放api生成的,其实啥都没有 * * http://labs.nticompassinc.com */ //ini_set("auto_detect_line_endings", true); $data = isset($_GET['data']) ? $_GET['data'] : 'http://weixin.qq.com/r/8bxsY6LEqpzVh7MAn_nV'; $size = isset($_GET['size']) ? $_GET['size'] : '200x200'; $logo = isset($_GET['logo']) ? $_GET['logo'] : './logo.jpg';//中间那logo图 // Get QR Code image from Google Chart API // http://code.google.com/apis/chart/infographics/docs/qr_codes.html //https://chart.googleapis.com/chart?cht=qr&chld=H|1&chs='.$size.'&chl='.urlencode($data)); $png = "http://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=Hello+world&chld=L|1&choe=UTF-8"; $QR = imagecreatefrompng($png);//Warning: imagecreatefrompng() [function.imagecreatefrompng]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? = //$QR = imagecreatefrompng('./chart.png');//外面那QR图 if($logo !== FALSE){ $logo = imagecreatefromstring(file_get_contents($logo)); $QR_width = imagesx($QR); $QR_height = imagesy($QR); $logo_width = imagesx($logo); $logo_height = imagesy($logo); // Scale logo to fit in the QR Code $logo_qr_width = $QR_width/5; $scale = $logo_width/$logo_qr_width; $logo_qr_height = $logo_height/$scale; $from_width = ($QR_width-$logo_qr_width)/2; //echo $from_width;exit; imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height); } header('Content-type: image/png'); imagepng($QR); imagedestroy($QR); ?>
CI框架连接数据库配置操作以及多数据库操作
asp 简单读取数据表并列出来 ASP如何快速从数据库读取大量数据
C语言关键字及其解释介绍 C语言32个关键字详解
C语言中sizeof是什么意思 c语言里sizeof怎样用法详解
PHP中的魔术方法 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep,
PHP中的(++i)前缀自增 和 (i++)后缀自增
将视频设置为Android手机开机动画的教程
最简单的asp登陆界面代码 asp登陆界面源代码详细介绍
常用dos命令及语法
PHP中include和require区别之我见
溧阳论坛触屏版手机版下载v5.4.2.18 安卓版
68.37MB |生活服务
保利悠悦荟最新版app2026下载v3.1.6 安卓版
35.73MB |生活服务
i泰达官方版下载v2.0.10 安卓版
66.01MB |生活服务
与糖医护手机版下载v4.2.0 安卓版
46.54MB |生活服务
智慧宫翻译阿拉伯语手机版下载v1.91.0 安卓版
50.68MB |生活服务
专注清单app下载v15.9 安卓版
42.61MB |生活服务
物性表手机版下载v2.3.0 安卓版
71.12MB |商务办公
hooli留学公寓app下载v5.6.1 安卓官方版
28.64MB |生活服务
2014-09-05
2022-03-20
2022-03-21
2022-03-24
2014-09-05
2014-09-05
2015-07-05
2014-09-05
2022-03-21
2014-09-05