您现在的位置是:首页> api 个人博客模板
阿拉伯数字转为大写中文数字
无痕小Q个人博客
2020-01-31 02:36:46【
主页】
1546人已围观
简介阿拉伯数字转为大写中文数字:该接口可以传入阿拉伯数字,将传入的阿拉伯数字转为大写汉字,支持小数点
接口地址https://yzc136.cn/api/open/toChineseNumerals
请求方式POST
请求参数 ( 参数名: num , 介绍: 这里传数字 , 参数: 1234.12 。)
返回示例:
{"errors":false,"data":"壹仟贰佰叁拾肆"}
介绍:
该接口可以将传入的数字转为汉字
返回参数
errors:接口状态
data:返回数据
php代码:
$host = "https://yzc136.cn/api/open/toChineseNumerals";
$method = "POST";
$headers = array();
array_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8");
$bodys = "num=1234.12";
$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/toChineseNumerals'
path = ''
method = 'POST'
appcode = ''
querys = ''
bodys = {}
url = host + path
bodys['num'] = '1234.12'
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)
阅读量! (1546)
点击排行
养活我啊,嗯,我觉得,能带我吃饭就好了。
网站公告
- 欢迎来到我的博客
1:欢迎来到我的博客
2:博客免费api接口现已上线
3:博客会定期更新文章
4:欢迎大家来捧场
站点信息
剑外忽传收蓟北,初闻涕泪满衣裳。 却看妻子愁何在,漫卷诗书喜欲狂。 白日放歌须纵酒,青春作伴好还乡。 即从巴峡穿巫峡,便下襄阳向洛阳。
- 建站时间:2019-8-30
- 网站程序:php,laravel-swoole框架
- 今日流量:602(10分钟统计一次)
- 本月流量:28316
- 浏览总量:454757
- 统计方式:中间件,redis消息队列,定时任务
申请链接友情链接
青山横北郭,白水绕东城。
此地一为别,孤蓬万里征。
浮云游子意,落日故人情。
挥手自兹去,萧萧班马鸣。