时间:2021-04-22 09:07:09 | 栏目:Golang | 点击:次
使用标准库http来实现
package tools import ( "io/ioutil" "net/http" ) func Get(url string)string{ res, err :=http.Get(url) if err != nil { return "" } robots, err := ioutil.ReadAll(res.Body) res.Body.Close() if err != nil { return "" } return string(robots) }