cURL
curl "https://api.ruseo.cn/api/ascii?text=Hello&action=encode&base=hex&separator=space&sep_custom=-&prefix=%5Cx"
ASCII编码解码工具,字符与ASCII码互转,支持中文等多字节字符。多种输出进制(十进制/十六进制/八进制/二进制),多种分隔符和前缀(x \u &#等),自动检测编码/解码操作,返回每个字符的详细编码信息
https://api.ruseo.cn/api/ascii
接口调用前需要确认的核心配置。
/api/asciiascii必填参数必须传入,示例值可直接用于联调。
免费API不强制要求API Key,但如果您希望统计个人调用次数,请在请求时附加参数 key=您的API_KEY。
注册账号后即可获得API Key。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
key |
否 | string | 可选参数:携带此参数可统计您的个人调用次数。请注册账号获取API Key。 | YOUR_API_KEY |
text |
是 | string | 要编码/解码的文本 | Hello |
action |
否 | string | encode/decode/auto默认auto自动检测 | encode |
base |
否 | string | 输出进制dec/hex/oct/bin默认dec | hex |
separator |
否 | string | 分隔符space/comma/semicolon/none/custom默认space | space |
sep_custom |
否 | string | 自定义分隔符separator=custom时生效 | - |
prefix |
否 | string | 编码前缀如\\x \\u &# 0x %等默认无 | \x |
优先使用示例地址测试请求参数是否正确。
https://api.ruseo.cn/api/ascii?text=Hello&action=encode&base=hex&separator=space&sep_custom=-&prefix=%5Cx
curl "https://api.ruseo.cn/api/ascii?text=Hello&action=encode&base=hex&separator=space&sep_custom=-&prefix=%5Cx"
$url = 'https://api.ruseo.cn/api/ascii?text=Hello&action=encode&base=hex&separator=space&sep_custom=-&prefix=%5Cx';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('https://api.ruseo.cn/api/ascii?text=Hello&action=encode&base=hex&separator=space&sep_custom=-&prefix=%5Cx')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "ascii",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
success |
boolean | 是否成功 | true |
action |
string | 执行的操作 | encode |
input |
string | 输入文本 | |
output |
string | 输出结果 | |
base |
string | 使用的进制 | hex |
details |
array | 每个字符的编码详情 | |
点击左侧“发送请求”查看结果...