返回 API 首页

二维码解析 API

纯本地化离线解码,不依赖任何第三方服务,保护您的隐私安全。支持通过图片直链或表单上传图片文件,快速提取二维码中隐藏的文本内容。

接口基本信息
请求方式 GETPOST
接口地址 https://api.nxzlm.com/qrcode-decode/api.php
返回格式 JSON
请求参数 (二选一)
参数名 类型 必填 说明
url String 条件 二维码图片的直链地址,需保证服务器可正常访问。支持 GET/POST。
file File 条件 二维码图片文件。仅支持 multipart/form-data 类型的 POST 上传。
各语言请求示例
  • PHP (cURL 上传)
  • JavaScript (Fetch)
  • Python (Requests)
<?php
// PHP 5.5+ / 8.0+ 推荐使用 CURLFile 进行文件上传
$apiUrl = 'https://api.nxzlm.com/qrcode-decode/api.php';
$filePath = '/path/to/your/qrcode.png';

$cFile = new CURLFile($filePath, 'image/png', 'qrcode.png');
$postData = array('file' => $cFile);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
// 使用 Fetch API 提交文件表单
const fileInput = document.querySelector('input[type="file"]');
const formData = new FormData();
formData.append('file', fileInput.files[0]);

fetch('https://api.nxzlm.com/qrcode-decode/api.php', {
    method: 'POST',
    body: formData
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
import requests

url = 'https://api.nxzlm.com/qrcode-decode/api.php'
file_path = '/path/to/your/qrcode.png'

with open(file_path, 'rb') as f:
    files = {'file': ('qrcode.png', f, 'image/png')}
    response = requests.post(url, files=files)
    
print(response.json())
JSON 格式返回示例
{
    "code": 200,
    "msg": "success",
    "data": {
        "text": "https://www.nxzlm.com/"
    }
}
接口在线测试
  • URL 链接解析
  • 本地图片上传解析

点击上传,或将二维码图片拖拽到此处