首页 二维码生成识别 二维码生成识别示例代码 二维码生成[PHP]

二维码生成示例代码[PHP]

作者: 阅读数:2371 上传时间:2016-03-10

二维码生成

<?php

require_once 'curl.func.php';

$appkey = 'your_appkey_here';
$text = 'https://www.jisuapi.com/api/sms';//utf8
$bgcolor = 'FFFFFF';
$fgcolor = '000000';
$oxlevel = 'L';
$width = 3;
$margin = 0;
$tempid = '';
$logo = 'https://www.jisuapi.com/static/images/icon/qrcode.png';
$url = "https://api.jisuapi.com/qrcode/generate?appkey=$appkey&text=$text&bgcolor=$bgcolor&fgcolor=$fgcolor&width=$width&margin=$margin&logo=$logo&oxlevel=$oxlevel&tempid=$tempid";
$result = curlOpen($url, ['ssl'=>true]);
$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));

if($jsonarr['status'] != 0)
{
    echo $jsonarr['msg'];
    exit();
}

$result = $jsonarr['result'];
$content = $result['qrcode'];
//file_put_contents('qrcode.png', base64_decode($content));
echo "";