go Base64 编码解码

go Base64 编码解码

package main import b64 "encoding/base64" import "fmt" func main() { data := "abc123!?$*&()'-=@~" sEnc := b64.StdEncoding.EncodeToString([]byte(data)) fm...

Goland 2020-10-26 PM 6次 0条
go 伪造User-Agent 抓取网页代码

go 伪造User-Agent 抓取网页代码

package main import ( "fmt" "io/ioutil" "net/http" "time" ) func main() { client := &http.Client{ Timeout: 2 * time.Second,...

Goland 2020-10-26 PM 8次 0条
go 获取自身路径

go 获取自身路径

package main import ( "fmt" "syscall" "unicode/utf16" "unsafe" ) var( kernel=syscall.MustLoadDLL("kernel32.dll") getModu...

Goland 2020-10-26 PM 5次 0条
goland 提交表单

goland 提交表单

package main import ( "net/http" "net/url" "fmt" "io/ioutil" ) func main() { //?mod=forumdisplay&fid=42 params:=url.Values{ ...

Goland 2020-10-26 PM 4次 0条
go字符串的遍历输出

go字符串的遍历输出

package main import ( "fmt" ) func main() { str := "Hello,世界" //方法一:格式化打印 for _, ch1 := range str { fmt.Printf("%q",ch1) //单引号围绕的字符字面值,由go语法安...

Goland 2020-10-26 PM 9次 0条
go 正则贪婪匹配

go 正则贪婪匹配

package main import ( "fmt" "regexp" ) func main(){ r,_:=regexp.Compile("aaa(.*?)bbb") matches:=r.FindAllString("42342342aaa111111111111bbbasd...

Goland 2020-10-26 PM 6次 0条
go UTF-8 to gbk 编码转换

go UTF-8 to gbk 编码转换

examplepackage main import "fmt" import "github.com/axgle/mahonia" func main(){ enc:=mahonia.NewEncoder("gbk") //converts a string from UTF-8 to gbk encoding. f...

Goland 2020-10-26 PM 6次 0条
golang中文字符编码转换

golang中文字符编码转换

golang处理中文时默认是utf8,当遇到其他如GBK字符是就会出现乱码,此处介绍golang 官方golang.org/x/text/encoding/simplifiedchinese包下的编码转换package main import "golang.org/x/text/encoding/simplifiedchinese" type Charset str...

Goland 2020-10-26 PM 6次 0条
go 语言模拟百度登录

go 语言模拟百度登录

go 语言模拟百度登录1.参考网上Python的例子自己写了一个go语言的。这个仅供学习技术参考,为了方便有部分参数直接phantomjs执行js获取,代码基本都有注释,测试打印没有删除,还请见谅!2.本文参考http://blog.csdn.net/qiye_/article/details/52884491话不多说,直接上码package main import ( &quo...

Goland 2020-10-26 PM 5次 0条
goland 获取unix时间

goland 获取unix时间

//获取unix时间 func getMillisecond() int64{ MS := time.Now().Unix() return MS }

Goland 2020-10-26 PM 9次 0条
sendcloud golang 发送短信 示例代码

sendcloud golang 发送短信 示例代码

package main import ( "fmt" "crypto/md5" "encoding/hex" "sort" "strings" "net/url" "bytes" &q...

Goland 2020-10-26 PM 8次 0条