您现在的位置是:首页> api 个人博客模板
把中文数字转为阿拉伯数字
无痕小Q个人博客
2020-01-31 02:42:52【
主页】
1398人已围观
简介把中文数字转为阿拉伯数字:该接口可以将大写汉字转未阿拉伯数字 支持汉字大小写
接口地址https://yzc136.cn/api/open/cn2num
请求方式POST
请求参数 ( 参数名: ch_str , 介绍: 大写汉字 , 参数: 壹仟贰佰叁拾肆 。)
返回示例:
{"errors":false,"data":1234}
介绍:
把中文数字转为阿拉伯数字接口
返回参数
errors:接口状态
data:返回数据
php代码:
$host = "https://yzc136.cn/api/open/cn2num";
$method = "POST";
$headers = array();
array_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8");
$bodys = "ch_str=壹仟贰佰叁拾肆";
$url = $host;
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
if (1 == strpos("$".$host, "https://"))
{
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);
var_dump(curl_exec($curl));
python代码:
import urllib, urllib2, sys
import ssl
host = 'https://yzc136.cn/class/api/open/cn2num'
path = ''
method = 'POST'
appcode = ''
querys = ''
bodys = {}
url = host + path
bodys['ch_str'] = '壹仟贰佰叁拾肆'
post_data = urllib.urlencode(bodys)
request = urllib2.Request(url, post_data)
request.add_header('Authorization', 'APPCODE ' + appcode)
request.add_header('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urllib2.urlopen(request, context=ctx)
content = response.read()
if (content):
print(content)
阅读量! (1398)
点击排行
欲下星斗动,天乐一声肌骨寒。 金霞昕昕渐东上,轮欹影促犹频望。 绝景良时难再并,他年此日应惆怅。
网站公告
- 欢迎来到我的博客
1:欢迎来到我的博客
2:博客免费api接口现已上线
3:博客会定期更新文章
4:欢迎大家来捧场
站点信息
在无数个失眠的晚上,相信会有很多人,习惯性的闭上眼睛,安静的想念一个人,
- 建站时间:2019-8-30
- 网站程序:php,laravel-swoole框架
- 今日流量:0(10分钟统计一次)
- 本月流量:0
- 浏览总量:396141
- 统计方式:中间件,redis消息队列,定时任务
申请链接友情链接
只有一个人在旅行时,才听得到自己的声音,它会告诉你,这世界比想象中的宽阔。