请求获取并展示二维码
现今,随机生成的二维码已经成为我们日常生活中常见的网络产物,本篇文章中,我们将给大家讲述如何用ThinkPHP生成随机二维码,感兴趣的朋友一起来了解一下吧。
请求获取并展示二维码
1 | <img src= "<?php echo U('createCode?zsnumber='.$time.$kcname['id'].$stuInfo['id'].'&stuName='.$stuInfo['stu_name'].'&sfid='.$stuInfo['sfid'].'&kcName='.$kcname['classnew'].'&kcid='.$kcid.'&stuid='.$stuInfo['id'].'');?>" alt= "二维码" class = "code" >
|
Salin selepas log masuk
创建二维码
1 2 3 4 5 6 7 | public function createCode(){
header('Content-Type: image/png');
Vendor('phpqrcode.phpqrcode');
ob_clean();
$value = 'http:
$_GET ['kcName'].'&kcid='. $_GET ['kcid'].'&stuid='. $_GET ['stuid'].''; \QRcode::png( $value ,false, 'H', 8, 2, false); }
|
Salin selepas log masuk
二维码链接信息处理
1 2 3 4 5 6 7 8 | public function showcode(){
dump( $_GET ); 获得二维码中信息
$temp ['kcid'] = $_GET ['kcid'];
$temp ['userid'] = $_GET ['stuid'];
$info = D('表名')->where( $temp )->find();
$this ->assign('info', $info );
$this ->display();
}
|
Salin selepas log masuk
相关教程:PHP视频教程
Atas ialah kandungan terperinci 如何用thinkphp框架生成二维码. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!