# ThinkAdmin 生成二维码 **Repository Path**: wwwadmin/thinkadmin_generate_qr_code ## Basic Information - **Project Name**: ThinkAdmin 生成二维码 - **Description**: tp6.0 ThinkAdmin 生成二维码 - **Primary Language**: PHP - **License**: AFL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 0 - **Created**: 2020-05-15 - **Last Updated**: 2023-08-05 ## Categories & Tags **Categories**: barcode **Tags**: None ## README # ThinkAdmin 生成二维码 #### 介绍 tp6.0 ThinkAdmin 生成二维码 #### 软件架构 软件架构说明 #### 安装教程 1. 使用composer.json 2. xxxx 3. xxxx #### 使用说明 1. 后端直接引入new然后按自己的需求调整二维码大小就可以了 2. 前段是Vue的写法希望你看的懂 3. xxxx 示例代码如下php info['path'] = '/ucserver/api.Tools/qrcode'; $this->info = json_encode($this->info,JSON_UNESCAPED_UNICODE); $this->fetch(); } /** * 生成二维码 * @param string */ public function qrcode($data = ''){ $qrCode = new QrCode(); $qrCode ->setText($data) ->setSize(300) ->setPadding(10) ->setErrorCorrection('high') ->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0]) ->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]) ->setLabel('') ->setLabelFontSize(16) ->setImageType(QrCode::IMAGE_TYPE_PNG); header('Content-Type: '.$qrCode->getContentType());//输出到页面 $qrCode->render(); die; } }