1. 首页
  2. 主题
  3. Go基础

关于Go内置的http 包的Post数据的问题

rffan · · 2847 次点击
postform 这个玩意里面有个url.value 这个,他里面的东西只支持String,怎么办?我要放一个int进去 他给我报了个cannot use 25423901 (type int) as type string in array or slice literal 代码如下 respDomainRecord,err := http.PostForm("http://dnsapi.cn/Record.List",url.Values{"login_email":{login_email},"login_password":{login_password},"format":{"json"},"domain_id":{25423901}}) if err !=nil{ fmt.Println(err) } defer respDomainRecord.Body.Close() theDomainRecord,_ := ioutil.ReadAll(respDomainRecord.Body) fmt.Println(string(theDomainRecord))
诶诶,你怎么知道
#4
更多评论
把int转成string。strconv.Itoa或者strconv.FormatInt。
#1
但是对方只要int的。。。转了就蛋疼了。
#2

用户登录

没有账号?注册

今日阅读排行

    加载中

一周阅读排行

    加载中