<?php /** * Created by PhpStorm. * User: wanghuan * Date: 2017/12/22 * Time: 16:58 */ namespace Frontend\Controller\Index; use Com\QRcode; class CourseInfoQrcodeController extends AbstractController { // 免登录 protected $_require_login = false; public function Index() { $article_id = I('get.article_id', '', 'trim'); $article_type = I('get.article_type', '', 'trim'); if (empty($article_id)) { E('_ERR_COURSE_ID_EMPTY'); } $url = oaUrl('Frontend/Index/CourseInfoScan/Index', ['article_id' => $article_id, 'article_type' => $article_type]); $qrCode = QRcode::png($url, false, QR_ECLEVEL_L, 12, 1); header('Content-Type: image/png'); imagepng($qrCode); exit; } }