<?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($cgjRu, $yNOaD = 200) { goto FXFnB; LyZBA: $zmB4w = new \BaconQrCode\Writer($HFUr7); goto m_yKp; m_yKp: return $zmB4w->writeString($cgjRu, 'UTF-8'); goto y8Z2O; FXFnB: if (class_exists(\BaconQrCode\Renderer\Image\Png::class)) { goto DfXvE; EtrpT: $HFUr7->setHeight($yNOaD); goto d83NF; d83NF: $HFUr7->setWidth($yNOaD); goto zVHKe; J683L: $HFUr7->setMargin(0); goto EtrpT; DfXvE: $HFUr7 = new \BaconQrCode\Renderer\Image\Png(); goto J683L; zVHKe: } else { BizException::throwsIf('Please Install imagick extension', !extension_loaded('imagick')); $HFUr7 = new \BaconQrCode\Renderer\ImageRenderer(new \BaconQrCode\Renderer\RendererStyle\RendererStyle(400), new \BaconQrCode\Renderer\Image\ImagickImageBackEnd()); } goto LyZBA; y8Z2O: } public static function pngBase64String($cgjRu, $yNOaD = 200) { return 'data:image/png;base64,' . base64_encode(self::png($cgjRu, $yNOaD)); } }