生成二维码
本API提供二维码生成功能。支持生成PNG位图或SVG矢量格式的二维码,可自定义尺寸、纠错级别、边框宽度等参数。适用于需要集成二维码生成功能的Web应用、移动应用或第三方系统。
接口信息
GET / POST
api.11as.cn/api/qrcode/createqrcode.php
Method
GET / POST
分类
未分类
Calls
300
KEY
无需 KEY
计费
免费
QPM
不限制
鉴权方式
无需密钥
作者
请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| key | string | 否 | 平台 API 访问密钥(选填) | sk_xxxxxxxxxxxxxxxx |
| data | string | 是 | 二维码中包含的文本内容(URL、文本、联系方式等),必填,建议不超过900个字符 | |
| size | string | 否 | 二维码尺寸,格式为'256'或'256x256',默认256x256像素 | |
| format | string | 否 | 输出格式,可选值:png(位图,默认)、svg(矢量图) | |
| error_correction | string | 否 | 纠错级别,可选值:L(7%)、M(15%,默认)、Q(25%)、H(30%) | |
| border | integer | 否 | 边框宽度(以码点为单位),默认2,最小0 | |
| raw | integer | 否 | 直接输出图片模式,1=直接输出图片流到浏览器,0或不传=返回JSON(默认) | |
| download | integer | 否 | 下载模式,1=触发浏览器下载图片,0或不传=不下载(默认)。优先级低于raw |
[
{
"name": "key",
"type": "string",
"required": false,
"description": "平台 API 访问密钥(选填)",
"example": "sk_xxxxxxxxxxxxxxxx"
},
{
"name": "data",
"type": "string",
"required": true,
"description": "二维码中包含的文本内容(URL、文本、联系方式等),必填,建议不超过900个字符",
"example": ""
},
{
"name": "size",
"type": "string",
"required": false,
"description": "二维码尺寸,格式为'256'或'256x256',默认256x256像素",
"example": ""
},
{
"name": "format",
"type": "string",
"required": false,
"description": "输出格式,可选值:png(位图,默认)、svg(矢量图)",
"example": ""
},
{
"name": "error_correction",
"type": "string",
"required": false,
"description": "纠错级别,可选值:L(7%)、M(15%,默认)、Q(25%)、H(30%)",
"example": ""
},
{
"name": "border",
"type": "integer",
"required": false,
"description": "边框宽度(以码点为单位),默认2,最小0",
"example": ""
},
{
"name": "raw",
"type": "integer",
"required": false,
"description": "直接输出图片模式,1=直接输出图片流到浏览器,0或不传=返回JSON(默认)",
"example": ""
},
{
"name": "download",
"type": "integer",
"required": false,
"description": "下载模式,1=触发浏览器下载图片,0或不传=不下载(默认)。优先级低于raw",
"example": ""
}
]
返回示例
## 成功响应(默认Base64模式)
{
"code": 200,
"data": {
"image_base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"image_url": "https://api.2dcode.biz/v1/create-qr-code?data=Example&size=256x256&format=png&error_correction=M&border=2",
"api_url": "https://api.xunjinlu.fun/api/qrcode/createqrcode.php",
"format": "png",
"size": "256x256",
"data_content": "Example",
"error_correction": "M",
"border": 2,
"direct_image_url": "https://api.xunjinlu.fun/api/qrcode/createqrcode.php?data=Example&raw=1&size=256x256&format=png"
},
"message": "success"
}
## 错误响应示例
{
"code": 400,
"data": null,
"message": "参数验证失败: data参数不能为空"
}
{
"code": 502,
"data": null,
"message": "二维码生成失败: HTTP Error: 503"
}
接口反馈
暂无详细文档
快速上手
暂无代码示例。管理员可在后台用 AI 生成或手动编写。
免责声明
使用本平台接口即表示同意本声明。
- 数据来源:接口数据来自第三方公开网络或用户上传,本平台不保证准确性、完整性、实时性,请以官方信息为准。
- 合法性与安全性:本平台无法核实每个接口的安全性、合法性,使用者自行承担相关风险。
- 用途限制:标注“学习专用”的接口禁止商用;严禁用于违法违规行为(如诈骗、赌博、侵权等)。违规后果由使用者自行承担。
- 损害免责:使用本接口产生的任何直接或间接损失,本平台不承担责任。
- 第三方上传:用户/商户上传的接口若侵权或违法,由上传者承担全部责任。
- 监督配合:本平台依法记录访问日志,如发现违法活动将配合执法部门处理,并有权随时限制或封禁服务。
注:本平台保留最终解释权,并可能随时更新本声明。
在线测试
请求地址
api.11as.cn/api/qrcode/createqrcode.php
Method
参数
Response
等待中
// 结果将在此处显示