cURL
curl "https://api.ruseo.cn/api/pinyin?text=%E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8C&style=tone&separator=demo"
将中文文本转换为拼音,支持带声调、无声调、数字声调三种风格。依赖 overtrue/pinyin 库。
https://api.ruseo.cn/api/pinyin
接口调用前需要确认的核心配置。
/api/pinyinpinyin必填参数必须传入,示例值可直接用于联调。
免费API不强制要求API Key,但如果您希望统计个人调用次数,请在请求时附加参数 key=您的API_KEY。
注册账号后即可获得API Key。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
key |
否 | string | 可选参数:携带此参数可统计您的个人调用次数。请注册账号获取API Key。 | YOUR_API_KEY |
text |
是 | string | 需要转换的中文文本 | 你好世界 |
style |
否 | string | tone=带声调 letter=无声调 number=数字声调 | tone |
separator |
否 | string | 拼音分隔符,默认空格 | |
优先使用示例地址测试请求参数是否正确。
https://api.ruseo.cn/api/pinyin?text=%E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8C&style=tone&separator=demo
curl "https://api.ruseo.cn/api/pinyin?text=%E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8C&style=tone&separator=demo"
$url = 'https://api.ruseo.cn/api/pinyin?text=%E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8C&style=tone&separator=demo';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('https://api.ruseo.cn/api/pinyin?text=%E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8C&style=tone&separator=demo')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "pinyin",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
input.text |
string | 中文文本 | 你好世界 |
result.pinyin |
string | 拼音 | ni hao shi jie |
result.acronym |
string | 首字母缩写 | nhsj |
点击左侧“发送请求”查看结果...