作者 开飞机的舒克

二维码生成

... ... @@ -69,6 +69,11 @@ class Demo extends Api
*/
public function test3()
{
$unique = "张三";
$generate = Generate::qr();
$file_path = $generate->create($unique,true,true);
$file_path = substr($file_path,strripos($file_path,"public")+6);
return $file_path;
}
}
... ...
... ... @@ -54,9 +54,9 @@ class Qr extends Gateway{
}
if(is_int($data)){
$file_name = 'qr'.$data.'.png';
}else{
$file_name = 'qr'.date('YmdHis').rand(1111,9999).'.png';
}else{
$file_name = $data.'.png';
}
$filename = $filePath.$file_name;
QRcode::png($data, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
... ...