package main
import(
"fmt"
"net/url"
"log"
)
func main() {
u, err := url.Parse("http://bing.com/search?q=dotnet")
fmt.Println(u)
if err != nil {
log.Fatal(err)
}
q := u.Query()
fmt.Println(q)
q.Set("id", "golang")
fmt.Println(q)
u.RawQuery = q.Encode()
fmt.Println(u)
u.Scheme = "https"
u.Host = "google.com"
}
go -- url包
最新推荐文章于 2024-07-17 08:47:10 发布