Home>Article>Backend Development> How to generate QR code using thinkphp framework
Request to obtain and display QR code
Nowadays, randomly generated QR codes have become a common network product in our daily lives. In this article, we will tell you how to use ThinkPHP to generate random QR codes. QR code, if you are interested, let’s learn about it together.
Request to obtain and display QR code
Create QR code
public function createCode(){ header('Content-Type: image/png'); Vendor('phpqrcode.phpqrcode'); ob_clean(); // 这里一开始我没有加 显示正常 后来就一直显示不了了 之后加上就好了 网上也有几种说法,但是我认为是缓冲区的问题 $value = 'http://XXXXXX/Home/mystudy/showcode?zsnumber='.$_GET['zsnumber'].'&stuName='.$_GET['stuName'].'&sfid='.$_GET['sfid'].'&kcName='. $_GET['kcName'].'&kcid='.$_GET['kcid'].'&stuid='.$_GET['stuid'].''; \QRcode::png($value,false, 'H', 8, 2, false); }
QR code link information processing
public function showcode(){ dump($_GET); 获得二维码中信息 $temp['kcid'] =$_GET['kcid']; $temp['userid'] = $_GET['stuid']; $info = D('表名')->where($temp)->find(); $this->assign('info',$info); $this->display(); }
Related tutorials:PHP video tutorial
The above is the detailed content of How to generate QR code using thinkphp framework. For more information, please follow other related articles on the PHP Chinese website!