12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package main
- import (
- "encoding/base64"
- "fmt"
- "log"
- "net/url"
- )
- func main() {
- str := "W3RpOuWwj+WNil0KW2FyOumZiOeykl0KW2FsOuWwj+aipuWkp+WNil0KW2J5Ol0KW29mZnNldDowXQpbMDA6MDAuMDBd5bCP5Y2KIChTdG9tYWNoKSAtIOmZiOeykgpbMDA6MDAuMDhd6K+N77ya5raC546y5a2QClswMDowMC4xNl3mm7LvvJrpmYjnspIKWzAwOjAwLjI0Xee8luabsu+8mumZiOeyki/ojZLkupXljYHkuIAv5pyx5a625piOL+WugeWtkOi+vgpbMDA6MDAuMzNd5LiN5pWi5Zue55yLClswMDowMi4zOV3lt6bpob7lj7Pnm7zkuI3oh6rnhLbnmoTmmpfoh6rllpzmrKIKWzAwOjA2Ljc1XeWBt+WBt+aQreiuquaAu+ayoeWujOWcsOWdkOeri+mavuWuiQpbMDA6MTEuMDhd6K+V5o6i6K+05pma5a6JClswMDoxMi44OV3lpJrnqbrms5vlj4jlv4PphbgKWzAwOjE3LjY4XeS9juWktOWRouWWgwpbMDA6MTkuOTJd5a+55L2g55qE5YGP54ix5aSq6L+H5LqO5piO55uu5byg6IOGClswMDoyNC4yM13lnKjljp/lnLDmiZPovaznmoTlsI/kuJHkvKTlv4PkuI3mlq0KWzAwOjI4LjU4XeepuuepuueVmemBl+aGvgpbMDA6MzAuMzFd5aSa6Zq+5aCq5Y+I5Li66Zq+ClswMDozNC41NV3ph4rnhLYg5oW15oeSIOWwveasogpbMDA6MzcuOTFd5pe26Ze06aOO5bmy5ZCO5L2g5LiO5oiR5YaN5peg5YWzClswMDo0My4zMF3msqHnrZTmoYgg5oCO5LmI5YqeClswMDo0NS44Ml3nnIvkuI3mg6/oh6rmiJHmrLrnnpIKWzAwOjUxLjUyXee6teWuueedgCDllpzmrKLnmoQg6K6o5Y6M55qEClswMDo1NC43Ml3lrqDmurrnmoQg5Y6M5YCm55qEClswMDo1Ni44OF3kuIDk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gCDllpzmrKLnmoQg6K6o5Y6M55qEClswMjoyNi4zM13lrqDmurrnmoQg5Y6M5YCm55qEClswMjoyOC42MV3kuIDkuKrkuKrmhaLmhaLpu6/mt6EKWzAyOjMxLjg5Xee6teWuueedgCDku7vmgKfnmoQg6ZqP5oSP55qEClswMjozNS4wM13mlL7ogobnmoQg6L275piT55qEClswMjozNy4yNF3lsIbmiYDmnInmrKLohLHlgL7nv7sKWzAyOjQwLjU4XeS4jeW6lOivpSDlpKrlv4Pova8g5LiN5aSn6IOGClswMjo0My43NF3lpKrmrbvmnb8g5LiN5p6c5patClswMjo0Ni4wMV3njqnlvITnnYDogobml6Dlv4zmg64KWzAyOjQ5LjI1XeS4jeW6lOivpSDoiI3lvIPkuoYg5q275b+D5LqGClswMjo1Mi41MV3mlL7miYvkuoYg5pat5b+15LqGClswMjo1NC42OF3ml6Dlj6/lpYjkvZXkuI3ogJDng6YKWzAzOjE1LjY2XeS7u+eUseedgCDkvaDourLpl6og5oiR6L+96LW2ClswMzoxOC42N13kvaDotbDmlaMg5oiR5ZG85ZaKClswMzoyMC44OV3mmK/osIHlnKjms5vms5vogIzosIgKWzAzOjI0LjE5XeS7u+eUseedgCDkvaDmnaXkuoYg5L2g56yR5LqGClswMzoyNy40Ml3kvaDotbDkuoYg5LiN55yL5oiRClswMzoyOS42MF3kuI7nkIbmiYDlvZPnhLbliIbmkYoKWzAzOjMzLjAyXeS4jeaYjueZvSDmrovlrZjnmoQg5rKh55So55qEClswMzozNi4xMF3lpJrkvZnnmoQg5LiN5b+F55qEClswMzozOC4zMV3noLTng4LkuZ/lnKjmiYvntKfmlKUKWzAzOjQxLjY0XeS4jeaYjueZvSDosIHotafnhLYg6LCB5peg56uvClswMzo0NC44NV3osIHlj6Tmnb8g6LCB5p6B56uvClswMzo0Ny4wOF3ml6DovpzkuI3nn6XmiYDku6XnhLYKWzAzOjUwLjU0XeS4jeeuoQpbMDM6NTEuNjhd57q15a65552AIOWWnOasoueahCDorqjljoznmoQKWzAzOjUzLjU4XeWuoOa6uueahCDljozlgKbnmoQKWzAzOjU1Ljc2XeS4gOS4quS4quaFouaFoum7r+a3oQpbMDM6NTkuMTFd57q15a65552AIOS7u+aAp+eahCDpmo/mhI/nmoQKWzA0OjAyLjMxXeaUvuiChueahCDovbvmmJPnmoQKWzA0OjA0LjQ2XeWwhuaJgOacieasouiEseWAvue/uwpbMDQ6MDcuNzhd5LiN5bqU6K+lIOWkquW/g+i9ryDkuI3lpKfog4YKWzA0OjEwLjk5XeWkquatu+advyDkuI3mnpzmlq0KWzA0OjEzLjIwXeeOqeW8hOedgOiChuaXoOW/jOaDrgpbMDQ6MTYuNTNd5LiN5bqU6K+lIOiIjeW8g+S6hiDmrbvlv4PkuoYKWzA0OjE5LjcyXeaUvuaJi+S6hiDmlq3lv7XkuoYKWzA0OjIxLjkyXeaXoOWPr+WliOS9leS4jeiAkOeDpg=="
- decodeBytes, err := base64.StdEncoding.DecodeString(str)
- if err != nil {
- log.Fatalln(err)
- }
- fmt.Println(string(decodeBytes))
- str2 := "https://h5.pingmishu.com/marketHome?channel=A18680378742"
- encodeStr := base64.StdEncoding.EncodeToString([]byte(str2))
- fmt.Println(encodeStr)
- escapeStr := url.QueryEscape(str2)
- fmt.Println(escapeStr)
- //input := []byte("hello world")
- //
- //// 演示base64编码
- //encodeString := base64.StdEncoding.EncodeToString(input)
- //fmt.Println(encodeString)
- //
- //// 对上面的编码结果进行base64解码
- //decodeBytes, err := base64.StdEncoding.DecodeString(encodeString)
- //if err != nil {
- // log.Fatalln(err)
- //}
- //fmt.Println(string(decodeBytes))
- //
- //fmt.Println("///////////////////////////////")
- //
- //// 如果要用在url中,需要使用URLEncoding
- //uEnc := base64.URLEncoding.EncodeToString([]byte(input))
- //fmt.Println(uEnc)
- //
- //uDec, err := base64.URLEncoding.DecodeString(uEnc)
- //if err != nil {
- // log.Fatalln(err)
- //}
- //fmt.Println(string(uDec))
- }
|