为了账号安全,请及时绑定邮箱和手机立即绑定

带有Golang的HTML表单方法发布

带有Golang的HTML表单方法发布

Go
万千封印 2021-04-06 14:19:55
因此,我在html中有此表单。它旨在向/subscribe页面发出POST请求:<html>  <form action="/subscribe" method="post">    First Name: <input type="text" name="first_name" placeholder="Willy"/><br/>    Last Name: <input type="text" name="last_name" placeholder="Warmwood"/><br/>    Email: <input type="email" name="email" placeholder="willy.warwood@gmail.com"/><br/>    <input type="submit" value="Submit"/>  </form></html>然后,我在golang中安装了此路由器:http.HandleFunc("/subscribe/", SubscribeHandler)而在golang中的此处理程序:func SubscribeHandler(w http.ResponseWriter, r *http.Request) {    log.Println(r.Method)}但是问题是,它总是print GET。如何过帐表格,所以的价值r.Method是POST?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 249 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信