纯本地化离线解码,不依赖任何第三方服务,保护您的隐私安全。支持通过图片直链或表单上传图片文件,快速提取二维码中隐藏的文本内容。
| 请求方式 | GET 或 POST |
| 接口地址 | https://api.nxzlm.com/qrcode-decode/api.php |
| 返回格式 | JSON |
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| url | String | 条件 | 二维码图片的直链地址,需保证服务器可正常访问。支持 GET/POST。 |
| file | File | 条件 | 二维码图片文件。仅支持 multipart/form-data 类型的 POST 上传。 |
<?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())
{
"code": 200,
"msg": "success",
"data": {
"text": "https://www.nxzlm.com/"
}
}
点击上传,或将二维码图片拖拽到此处