使用標準庫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) }
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/50424.html
標籤:Go
