studygolang如何获取GET/POST方法的值?

xuzhiping7 · 2013-07-19 15:21:42 · 9269 次点击 · 大约8小时之前 开始浏览    置顶
这是一个创建于 2013-07-19 15:21:42 的主题,其中的信息可能已经有所发展或是发生改变。

例如我想试试用studygolang连上微信公共平台,公共平台那边将会给我发一个GET请求,里面包涵了token、timestamp、nonce参数,我该如何获取这三个参数?

假设它的请求地址是:121.121.121.121/wechat


有疑问加站长微信联系(非本文作者)

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

9269 次点击  
加入收藏 微博
2 回复  |  直到 2013-07-21 08:34:13
xuzhiping7
xuzhiping7 · #1 · 12年之前

post 的值可以在http.form获得,但get的还是没能找到,要自己根据URL格式将值拼出来?

polaris
polaris · #2 · 12年之前

net/http 包中,Request 结构中有说明:

// Form contains the parsed form data, including both the URL
// field's query parameters and the POST or PUT form data.
// This field is only available after ParseForm is called.
// The HTTP client ignores Form and uses Body instead.
Form url.Values

// PostForm contains the parsed form data from POST or PUT
// body parameters.
// This field is only available after ParseForm is called.
// The HTTP client ignores PostForm and uses Body instead.
PostForm url.Values
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传