码迷,mamicode.com
首页 > Web开发 > 详细

golang urlencode

时间:2017-09-27 13:31:56      阅读:294      评论:0      收藏:0      [点我收藏+]

标签:返回结果   pop   popstar   hds   make   ssi   val   app   safari   

u := url.Values{}
    u.Set("a", "1")
    u.Set("b", "2")
    u.Set("data", `{"sessionId":"0bts0W1DWKm70B4UZq3V1h3r2DpsbhDsc2WD","eventId":"8F2qNf0bts0W1DWKm70B4UZq3V1h3r2Dpsbh","androidId":"b22f3d41736f748c","userAgent":"Mozilla/5.0 (Linux; Android 5.1; MI PAD 2 Build/LMY47I; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Safari/537.36","osVersion":"5.1.1","bundleId":"com.brianbaek.popstar","connectionType":"wifi","deviceMake":"Xiaomi","deviceModel":"MI PAD 2","language":"zh_CN","timeZone":"GMT+08:00","campaignId":3261,"mac":"38:a4:ed:fe:99:c8"}`)
    fmt.Println(u.Encode())

返回结果:

a=1&b=2&data=%7B%22sessionId%22%3A%220bts0W1DWKm70B4UZq3V1h3r2DpsbhDsc2WD%22%2C%22eventId%22%3A%228F2qNf0bts0W1DWKm70B4UZq3V1h3r2Dpsbh%22%2C%22androidId%22%3A%22b22f3d41736f748c%22%2C%22userAgent%22%3A%22Mozilla%2F5.0+%28Linux%3B+Android+5.1%3B+MI+PAD+2+Build%2FLMY47I%3B+wv%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Version%2F4.0+Chrome%2F55.0.2883.91+Safari%2F537.36%22%2C%22osVersion%22%3A%225.1.1%22%2C%22bundleId%22%3A%22com.brianbaek.popstar%22%2C%22connectionType%22%3A%22wifi%22%2C%22deviceMake%22%3A%22Xiaomi%22%2C%22deviceModel%22%3A%22MI+PAD+2%22%2C%22language%22%3A%22zh_CN%22%2C%22timeZone%22%3A%22GMT%2B08%3A00%22%2C%22campaignId%22%3A3261%2C%22mac%22%3A%2238%3Aa4%3Aed%3Afe%3A99%3Ac8%22%7D

 

golang urlencode

标签:返回结果   pop   popstar   hds   make   ssi   val   app   safari   

原文地址:http://www.cnblogs.com/kccdzz/p/7600835.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!