GET
文本工具
字数统计
统计总字数、中文数、英文单词数、行数、字节数等。
累计调用 14
今日调用 0
更新于 2026-10-16
调用地址
GET
https://itapi.top/api/wordcount
请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| text | string | 必填 | 要统计的文本 | 测试文本 |
返回字段
| 字段名 | 类型 | 说明 |
|---|---|---|
| code | int | 状态码 |
| data.total_chars | int | 总字符数 |
| data.chinese | int | 中文字数 |
| data.english_words | int | 英文单词数 |
| data.lines | int | 行数 |
响应示例
200 OK
{"code":200,"msg":"success","data":{"total_chars":4,"chars_no_space":4,"chinese":4,"english_words":0,"numbers":0,"lines":1,"bytes":12}}
在线测试
代码示例
cURL · GET
curl "https://itapi.top/api/wordcount?text=%E6%B5%8B%E8%AF%95%E6%96%87%E6%9C%AC"
PHP
<?php
$res = file_get_contents("https://itapi.top/api/wordcount?text=%E6%B5%8B%E8%AF%95%E6%96%87%E6%9C%AC");
$json = json_decode($res, true);
print_r($json);
JavaScript
const res = await fetch("https://itapi.top/api/wordcount?text=%E6%B5%8B%E8%AF%95%E6%96%87%E6%9C%AC");
const json = await res.json();
console.log(json);
Python
import requests
r = requests.get("https://itapi.top/api/wordcount?text=%E6%B5%8B%E8%AF%95%E6%96%87%E6%9C%AC", timeout=10)
print(r.json())