V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  noahsophie  ›  全部回复第 5 页 / 共 7 页
回复总数  122
1  2  3  4  5  6  7  
2019-07-03 17:14:13 +08:00
回复了 noahsophie 创建的主题 Go 编程语言 Go 发送 http 请求, PHP 获取不到参数
@ben1024 不行,都是空

#Go 客户端
```
client := &http.Client{}
req, err := http.NewRequest(
"POST",
"http://127.0.0.1/login/check",
strings.NewReader("username=admin&password=123456"),
)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
resp, _ := client.Do(req)
defer resp.Body.Close()
```
这样写,php 可以获取到参数,但是 req 我想单独设置 body,而不是放在 NewRequest 里面
NTE0NDk5NjEwQHFxLmNvbQ==
2019-05-09 10:16:00 +08:00
回复了 fedfrank 创建的主题 职场话题 自制力差,一下班就想玩,有没有什么好的解决方案
不下班~
2019-03-22 10:21:21 +08:00
回复了 noahsophie 创建的主题 服务器 阿里云余额还有万把块,能干些什么?
@zhm20103526565 noah_sophie
1  2  3  4  5  6  7  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1055 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 24ms · UTC 19:10 · PVG 03:10 · LAX 12:10 · JFK 15:10
Developed with CodeLauncher
♥ Do have faith in what you're doing.