<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use BaconQrCode\Encoder\Encoder; use ModStart\Core\Exception\BizException; use ModStart\ModStart; class QrcodeUtil { public static function png($gP2DQ, $Klf84 = 200) { goto CTrz3; a6HnA: $JmtqK = new \BaconQrCode\Writer($aLsju); goto fAXYJ; CTrz3: if (class_exists(\BaconQrCode\Renderer\Image\Png::class)) { goto OnyvX; OnyvX: $aLsju = new \BaconQrCode\Renderer\Image\Png(); goto qmRiF; wnUZX: $aLsju->setWidth($Klf84); goto k06Gc; qmRiF: $aLsju->setMargin(0); goto ce6h6; ce6h6: $aLsju->setHeight($Klf84); goto wnUZX; k06Gc: } else { BizException::throwsIf('Please Install imagick extension', !extension_loaded('imagick')); $aLsju = new \BaconQrCode\Renderer\ImageRenderer(new \BaconQrCode\Renderer\RendererStyle\RendererStyle(400), new \BaconQrCode\Renderer\Image\ImagickImageBackEnd()); } goto a6HnA; fAXYJ: return $JmtqK->writeString($gP2DQ, 'UTF-8'); goto znQ2Q; znQ2Q: } public static function pngBase64String($gP2DQ, $Klf84 = 200) { return 'data:image/png;base64,' . base64_encode(self::png($gP2DQ, $Klf84)); } }