Home  >  Article  >  Backend Development  >  javascript - What QR code API is generally used to generate QR codes for platform distribution?

javascript - What QR code API is generally used to generate QR codes for platform distribution?

WBOY
WBOYOriginal
2016-07-06 13:53:421186browse

What QR code API is generally used to generate QR codes? The purpose is for platform distribution

Reply content:

What QR code API is generally used to generate QR codes? The purpose is for platform distribution

Describe the specific usage scenario. PHP can use the third-party library qrcode

qrcode class library

TP’s

<code>     vendor("phpqrcode.phpqrcode");
        $QRcode = new QRcode();
        $data = $data?$data:'二维码生成有误,联系管理员处理!';
        // 纠错级别:L、M、Q、H
        $level = 'L';
        // 点的大小:1到10,用于手机端4就可以了
        $size = 8;
        //下面注释了把二维码图片保存到本地的代码,如果要保存图片,用$fileName替换第二个参数false
        $path ="./Public/Upload/QrcPic/";
        if(!is_dir($path)){
            mkdir($path,0777,true);
        }
        // 生成的文件名
        $fileName =$prefix.$sid.'.png'; 
        //判断文件是否存在,存在返回二维码图片名字
       // $checkFile = $path.$fileName;
        if(file_exists($checkFile)){
                return $fileName;
                exit;
        } 
        // 输出图处流
        //QRCimg=QRcode::png($data, $fileName, $level, $size, $padding);
        $QRcode->png($data,$path.$fileName,$level,$size, $padding);</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn