首先,下载phpqrcode,将其解压到项目thinkphp\library\vendor目录下。
index_index.html(模板可自行配置)
尺寸大小:
边距大小:
1px
2px
3px
5px
容错级别:
Low (7%)
Medium (15%)
Quartile (25%)
High (30%)
二维码内容:
二维码logo:控制器:IndexController.class.php
3145728,
'rootPath' => './upload/',
'savePath' => '',
'saveName' => array('uniqid',''),
'exts' => array('jpg', 'gif', 'png', 'jpeg'),
'autoSub' => true,
'subName' => array('date','Ymd'),
); $upload = new \Think\Upload($config);// 实例化上传类
// 上传单个文件
$info = $upload->uploadOne($_FILES['test']);
if(!$info) {// 上传错误提示错误信息
$qrcode_path_new = './Public/Home/images/code'.'_'.date("Ymdhis").'.png';
$content = $_POST['content'];
$matrixPointSize = $_POST['matrixPointSize'];
$matrixMarginSize = $_POST['matrixMarginSize'];
$errorCorrectionLevel = $_POST['errorCorrectionLevel'];
makecode_no_pic($content,$qrcode_path_new,$matrixPointSize,$matrixMarginSize,$errorCorrectionLevel); $this->assign('img',$qrcode_path_new);
}else{
$qrcode_path = "./upload/".
$info['savepath'].
$info['savename'];
$content = $_POST['content'];
$matrixPointSize = $_POST['matrixPointSize'];
$matrixMarginSize = $_POST['matrixMarginSize'];
$errorCorrectionLevel = $_POST['errorCorrectionLevel'];
$url = "./upload/qrcode/".date("YmdHis").".png";
makecode($qrcode_path,$content,$matrixPointSize,$matrixMarginSize,$errorCorrectionLevel,$url); $this->assign('img',$url);
}
$this->display();
}
}然后在项目Application/Home/Common下新建function.php
在没有图片上传的情况下,生成我二维码只是单纯的二维码,只有在有logo上传的时候,才会生成带logo的二维码。
如下图,即没有logo时生成的二维码:
立即学习“PHP免费学习笔记(深入)”;
魔法映像企业网站管理系统下载技术上面应用了三层结构,AJAX框架,URL重写等基础的开发。并用了动软的代码生成器及数据访问类,加进了一些自己用到的小功能,算是整理了一些自己的操作类。系统设计上面说不出用什么模式,大体设计是后台分两级分类,设置好一级之后,再设置二级并选择栏目类型,如内容,列表,上传文件,新窗口等。这样就可以生成无限多个二级分类,也就是网站栏目。对于扩展性来说,如果有新的需求可以直接加一个栏目类型并新加功能操作
下图即在有图片被上传的时候生成的二维码:













