接口路径(新):http://api.okayapi.com/api/Ext/Pinyin/Convert
接口路径(旧):http://api.okayapi.com/?s=Ext.Pinyin.Convert
接口描述: 将一段汉字串内容转成拼音
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
text | String | Required | 待转为拼音的字符串内容 |
请求:
{OKAYAPI_API_HOST}/?s=Ext.Pinyin.Convert&text=五一劳动节快乐&app_key={你的app_key}&sign={动态签名}
返回:
{
"ret": 200,
"data": {
"err_code": 0,
"err_msg": "",
"pinyin": "wu yi lao dong jie kuai le"
},
"msg": "",
"_t": 1682499985,
"_auth": "7f0e865cc0bd0c0bb065c0e0922dceb2"
}
<?php
// 引入文件
require_once dirname(__FILE__) . '/OkayApiClient.php';
// 调用小白开放接口(第一个示例:从省份开始选择):
$rs = OkayApiClient::request('Ext.Pinyin.Convert',array('text'=>'你好'));
// 输出结果
print_r($rs);
/*
Array
(
[ret] => 200
[data] => Array
(
[err_code] => 0
[err_msg] =>
[pinyin] => ni hao
)
[msg] => 小白开放接口:Ext.Pinyin.Convert
)
*/
KEY | Type | Description |
---|---|---|
pinyin | String | 拼音字符串,用空格隔开 |
接口路径(新):http://api.okayapi.com/api/Ext/Pinyin/Abbr
接口路径(旧):http://api.okayapi.com/?s=Ext.Pinyin.Abbr
接口描述: 获取首字符字符串
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
text | String | Required | 待转为拼音的字符串内容 | ||
save_other_char | Int | Optaion | 0 | 是否保留非中文的字符:1-是;0-否 |
<?php
// 引入文件
require_once dirname(__FILE__) . '/OkayApiClient.php';
// 调用小白开放接口(第一个示例:从省份开始选择):
$rs = OkayApiClient::request('Ext.Pinyin.Abbr',array('text'=>'你好'));
// 输出结果
print_r($rs);
/*
Array
(
[ret] => 200
[data] => Array
(
[err_code] => 0
[err_msg] =>
[pinyin] => n h
)
[msg] => 小白开放接口:Ext.Pinyin.Abbr
)
*/
KEY | Type | Description |
---|---|---|
pinyin | String | 拼音首字符串,用空格隔开 |
接口路径(新):http://api.okayapi.com/api/Ext/Pinyin/Sentence
接口路径(旧):http://api.okayapi.com/?s=Ext.Pinyin.Sentence
接口描述: 将会保留中文字符:,。 ! ? : “ ” ‘ ’ 并替换为对应的英文符号。
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
text | String | Required | 待转为拼音的字符串内容 |
<?php
// 引入文件
require_once dirname(__FILE__) . '/OkayApiClient.php';
// 调用小白开放接口(第一个示例:从省份开始选择):
$rs = OkayApiClient::request('Ext.Pinyin.Sentence',array('text'=>'小白接口,服务大众!'));
// 输出结果
print_r($rs);
/*
Array
(
[ret] => 200
[data] =>
Array
(
[err_code] => 0
[err_msg] =>
[pinyin] => xiao bai jie kou, fu wu da zhong!
)
[msg] => 小白开放接口:Ext.Pinyin.Sentence
)
*/
KEY | Type | Description |
---|---|---|
pinyin | String | 拼音字符串 |
接口路径(新):http://api.okayapi.com/api/Ext/Pinyin/Name
接口路径(旧):http://api.okayapi.com/?s=Ext.Pinyin.Name
接口描述: 姓名转拼音,姓名的姓的读音有些与普通字不一样,比如 ‘单’ 常见的音为 dan,而作为姓的时候读 shan。
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
text | String | Required | 待转为拼音的字符串内容 |
<?php
// 引入文件
require_once dirname(__FILE__) . '/OkayApiClient.php';
// 调用小白开放接口(第一个示例:从省份开始选择):
$rs = OkayApiClient::request('Ext.Pinyin.Name',array('text'=>'区静'));
// 输出结果
print_r($rs);
/*
Array
(
[ret] => 200
[data] =>
Array
(
[err_code] => 0
[err_msg] =>
[pinyin] => ou jing
)
[msg] => 小白开放接口:Ext.Pinyin.Name
)
*/
KEY | Type | Description |
---|---|---|
pinyin | String | 姓名对应的拼音字符串 |
Power by OkayAPI.com Contact us (WA: okayapi OR Email: chanzonghuang@gmail.com).
Timezone: America/New_York May/09/2025 03:31:43