这是我的SignIn方法代码
<pre><code>
func SignIn(rw http.ResponseWriter, req *http.Request) {
if req.Method != http.MethodPost {
rw.WriteHeader(http.StatusBadRequest)
return
}
req.ParseForm()
fmt.Println(req.Form)
fmt.Println(req.FormValue("phoneNum"))
for k,v := range req.Form{
fmt.Println("key:",k)
fmt.Println("val:",strings.Join(v,""))
}
fmt.Fprintf(rw,"this is SignInfunc")
return
}
</code></pre>
通过postman发送post请求 却或获取不到请求体中的参数。
![post.png](https://static.studygolang.com/180426/4c60203c5047a50e7b17616d43c98736.png)
有疑问加站长微信联系(非本文作者)