来自net / http的源代码。的定义http.Header是map[string][]string。正确的?
但是为什么要go run在下面的代码中得到结果:
0
2个
func main() {
var header = make(http.Header)
header.Add("hello", "world")
header.Add("hello", "anotherworld")
var t = []string {"a", "b"}
fmt.Printf("%d\n", len(header["hello"]))
fmt.Print(len(t))
}
相关分类