免费二维码在线生成API接口(支持HTTPS)

本文主要介绍国内外可用的免费qrcode二维码生成接口,主要追求国内可用、速度较快、稳定性较高。对于功能多样性上不做进一步讨论。

联图

评价:国内老牌,无明确限制,不支持https,有时拥挤速度较慢。

示例:http://qr.liantu.com/api.php?text=aspirantzhang

官网:http://www.liantu.com/pingtai/

QRCode.Online

评价:支持https,实测状态好,无明确限制,外国服务器,国内速度较好,稳定性未知。

示例:https://qrcode.online/img/?type=text&data=aspirantzhang

官网:https://qrcode.online/api

GoGR.Me

评价:德国人弄的,历史悠久,无明确限制,支持https,外国服务器,国内较慢,稳定性应该不错。

示例:https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=aspirantzhang

官网:http://goqr.me/api/

QRCode.JP

评价:日本人弄的,无明确限制,支持https,外国服务器,国内速度较好,稳定性未知。

示例:https://qrcode.jp/qr?q=aspirantzhang

官网:https://qrcode.jp/

总结

国内太烂,尚无免费又稳定的https二维码生成接口,海外一大堆,国内用又太慢,真是纠结。我决定改用js插件:Jquery-QRCode.JS ( https://github.com/jeromeetienne/jquery-qrcode)。

附一段可能有用的代码:

//中文编码格式转换
function utf16to8(str) {
    var out, i, len, c;
    out = "";
    len = str.length;
    for (i = 0; i < len; i++) {
        c = str.charCodeAt(i);
        if ((c >= 0x0001) && (c <= 0x007F)) {
            out += str.charAt(i);
        } else if (c > 0x07FF) {
            out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
            out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
            out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
        } else {
            out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
            out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
        }
    }
    return out;
}

 

点赞