thinkphp5 .1与 endroid 二维码生成+与活动图片合成

浏览:2176 发布日期:2018/08/13 分类:求助交流
public function img_qrcode($size=300,$text='',$logo_path="static/image/logo.jpg",$logo_width=100)
{
$qrCode = new QrCode($text);
$qrCode->setSize($size);
$qrCode->setWriterByName('png');
$qrCode->setMargin(10);
$qrCode->setEncoding('UTF-8');
$qrCode->setErrorCorrectionLevel(ErrorCorrectionLevel::HIGH);
$qrCode->setForegroundColor(['r' => 12, 'g' => 0, 'b' => 0, 'a' => 0]);
$qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]);
$qrCode->setLogoPath($logo_path);
$qrCode->setLogoWidth($logo_width);
$qrCode->setRoundBlockSize(true);
$qrCode->setValidateResult(false);
header('Content-Type: '.$qrCode->getContentType());
$response = new \think\Response($qrCode->writeString(), 200, ['Content-Type' => $qrCode->getContentType()]);
$response->contentType($qrCode->getContentType());
return $response;

}
最佳答案
评论( 相关
后面还有条评论,点击查看>>