首先:下载二维码的类库   phpqrcode文件
 

然后将下载好的文件放到/simplewind/Core/Library/Vendor下

public function scerweima(){


$url=www.baidu.com ;//将url地址写好

 Vendor('phpqrcode.phpqrcode');//加载类库
 
 
$errorCorrectionLevel = 'L'; //容错级别
$i=320;
$j = floor($i/37*100)/100 + 0.01;
$matrixPointSize = $j; //生成图片大小

 

 
//生成二维码图片
        $filename = SITE_PATH.'public/erweima/'.time().rand(100,999).'.png';//生成二维码的图片名称,以及保存地址
        $QRcode=new \QRcode();//实例化对象

 

$QRcode::png($url,$filename , $errorCorrectionLevel, $matrixPointSize, 2);
 
$QR = $filename; //已经生成的原始二维码图片文件

 

$QR = imagecreatefromstring(file_get_contents($QR));
 
 
return $filename;
}

相关文章:

  • 2022-12-23
  • 2021-06-16
  • 2021-08-09
  • 2022-12-23
  • 2021-11-21
  • 2021-11-21
猜你喜欢
  • 2021-11-21
  • 2021-11-21
  • 2021-12-11
  • 2021-10-29
  • 2021-06-01
相关资源
相似解决方案