[Go] Go语言的HTML模板(多值替换) →→→→→进入此内容的聊天室

来自 , 2021-01-21, 写在 Go, 查看 119 次.
URL http://www.code666.cn/view/4cea2358
  1. package main
  2.  
  3. import (
  4.         "html/template"
  5.         "os"
  6. )
  7.  
  8. func main() {
  9.         t, _ := template.New("demo").Parse(`{{define "T"}}Hello, {{.Username}}! Main Page: [{{.MainPage}}]{{end}}`)
  10.         args1 := map[string]string {"Username": "Hypermind", "MainPage": "http://hypermind.com.cn/go"}
  11.         _ = t.ExecuteTemplate(os.Stdout, "T", args1)
  12. }
  13.  
  14.  
  15. //go/5408

回复 " Go语言的HTML模板(多值替换)"

这儿你可以回复上面这条便签

captcha