二维码生成接口,支持文本、网址、Base64 内容,可指定尺寸、留白、纠错等级,支持直接输出 PNG 图片流。
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| content | string | 否 | 内容自动识别:网址自动补 https://,base64 自动解码,其余按文本处理(与 text / url / base64 三选一,优先级 text > url > base64 > content) | |
| text | string | 否 | 要生成二维码的文本内容(优先于 url / base64 / content) | |
| url | string | 否 | 要生成二维码的网址,无协议时自动补 https:// | |
| base64 | string | 否 | base64 编码的内容,自动解码后生成二维码(不做长度限制) | |
| size | string | 否 | 二维码尺寸:单值如 300(正方形),或 宽x高 如 220x220(支持 x/X/× 和空格),范围 100~2000,默认 300 | |
| margin | integer | 否 | 二维码留白像素,默认 20,范围 0~200 | |
| ecc | string | 否 | 纠错等级 L / M / Q / H,默认 M | |
| img | integer | 否 | 传 1 时直接输出 PNG 图片流(Content-Type: image/png),不返回 JSON;默认返回 JSON | |
| host | string | 否 | 指定返回图片地址的完整域名,如 https://api.example.com;不传时按当前请求推断 |
[
{
"name": "content",
"type": "string",
"required": false,
"description": "内容自动识别:网址自动补 https://,base64 自动解码,其余按文本处理(与 text / url / base64 三选一,优先级 text > url > base64 > content)",
"example": ""
},
{
"name": "text",
"type": "string",
"required": false,
"description": "要生成二维码的文本内容(优先于 url / base64 / content)",
"example": ""
},
{
"name": "url",
"type": "string",
"required": false,
"description": "要生成二维码的网址,无协议时自动补 https://",
"example": ""
},
{
"name": "base64",
"type": "string",
"required": false,
"description": "base64 编码的内容,自动解码后生成二维码(不做长度限制)",
"example": ""
},
{
"name": "size",
"type": "string",
"required": false,
"description": "二维码尺寸:单值如 300(正方形),或 宽x高 如 220x220(支持 x/X/× 和空格),范围 100~2000,默认 300",
"example": ""
},
{
"name": "margin",
"type": "integer",
"required": false,
"description": "二维码留白像素,默认 20,范围 0~200",
"example": ""
},
{
"name": "ecc",
"type": "string",
"required": false,
"description": "纠错等级 L / M / Q / H,默认 M",
"example": ""
},
{
"name": "img",
"type": "integer",
"required": false,
"description": "传 1 时直接输出 PNG 图片流(Content-Type: image/png),不返回 JSON;默认返回 JSON",
"example": ""
},
{
"name": "host",
"type": "string",
"required": false,
"description": "指定返回图片地址的完整域名,如 https://api.example.com;不传时按当前请求推断",
"example": ""
}
]
{
"openapi": "3.1.1",
"info": {
"title": "二维码",
"description": "二维码生成接口,支持文本、网址、Base64 内容,可指定尺寸、留白、纠错等级,支持直接输出 PNG 图片流。",
"version": "1.0.0"
},
"paths": {
"\/api\/demo\/qrcode\/index.php": {
"get": {
"summary": "二维码",
"description": "二维码生成接口,支持文本、网址、Base64 内容,可指定尺寸、留白、纠错等级,支持直接输出 PNG 图片流。",
"parameters": [
{
"name": "content",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "内容自动识别:网址自动补 https:\/\/,base64 自动解码,其余按文本处理(与 text \/ url \/ base64 三选一,优先级 text \u003E url \u003E base64 \u003E content)"
},
{
"name": "text",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "要生成二维码的文本内容(优先于 url \/ base64 \/ content)"
},
{
"name": "url",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "要生成二维码的网址,无协议时自动补 https:\/\/"
},
{
"name": "base64",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "base64 编码的内容,自动解码后生成二维码(不做长度限制)"
},
{
"name": "size",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "二维码尺寸:单值如 300(正方形),或 宽x高 如 220x220(支持 x\/X\/× 和空格),范围 100~2000,默认 300"
},
{
"name": "margin",
"in": "query",
"required": false,
"schema": {
"type": "integer"
},
"description": "二维码留白像素,默认 20,范围 0~200"
},
{
"name": "ecc",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "纠错等级 L \/ M \/ Q \/ H,默认 M"
},
{
"name": "img",
"in": "query",
"required": false,
"schema": {
"type": "integer"
},
"description": "传 1 时直接输出 PNG 图片流(Content-Type: image\/png),不返回 JSON;默认返回 JSON"
},
{
"name": "host",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "指定返回图片地址的完整域名,如 https:\/\/api.example.com;不传时按当前请求推断"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application\/json": {
"schema": {
"type": "object"
}
}
}
}
}
},
"post": {
"summary": "二维码",
"description": "二维码生成接口,支持文本、网址、Base64 内容,可指定尺寸、留白、纠错等级,支持直接输出 PNG 图片流。",
"parameters": [
{
"name": "content",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "内容自动识别:网址自动补 https:\/\/,base64 自动解码,其余按文本处理(与 text \/ url \/ base64 三选一,优先级 text \u003E url \u003E base64 \u003E content)"
},
{
"name": "text",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "要生成二维码的文本内容(优先于 url \/ base64 \/ content)"
},
{
"name": "url",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "要生成二维码的网址,无协议时自动补 https:\/\/"
},
{
"name": "base64",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "base64 编码的内容,自动解码后生成二维码(不做长度限制)"
},
{
"name": "size",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "二维码尺寸:单值如 300(正方形),或 宽x高 如 220x220(支持 x\/X\/× 和空格),范围 100~2000,默认 300"
},
{
"name": "margin",
"in": "query",
"required": false,
"schema": {
"type": "integer"
},
"description": "二维码留白像素,默认 20,范围 0~200"
},
{
"name": "ecc",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "纠错等级 L \/ M \/ Q \/ H,默认 M"
},
{
"name": "img",
"in": "query",
"required": false,
"schema": {
"type": "integer"
},
"description": "传 1 时直接输出 PNG 图片流(Content-Type: image\/png),不返回 JSON;默认返回 JSON"
},
{
"name": "host",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "指定返回图片地址的完整域名,如 https:\/\/api.example.com;不传时按当前请求推断"
}
],
"responses": {
"200": {
"description": "成功",
"content": {
"application\/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https:\/\/api.vsaa.cn",
"description": "当前访问入口(https)"
}
]
}
暂无详细文档
暂无代码示例。管理员可在后台用 AI 生成或手动编写。
欢迎使用 万象数据API(以下简称“本平台”,域名为 api.vsaa.cn)。在使用本平台提供的任何接口、数据及相关服务之前,请您务必仔细阅读并充分理解本免责声明的全部内容。您对本平台任何服务的使用,均视为您已阅读、理解并同意本声明的全部条款。
最后更新日期:2026年10月6日