如何防止轉(zhuǎn)義'到'html 模板:package mainimport ( "html/template" "os")const tmpl = `<html> <head> <title>{{.Title}}</title> </head></html>`func main() { t := template.Must(template.New("ex").Parse(tmpl)) v := map[string]interface{}{ "Title": template.HTML("Hello World'"), } t.Execute(os.Stdout, v)}它輸出:<html> <head> <title>Hello World'</title> </head></html>期望的輸出:<html> <head> <title>Hello World'</title> </head></html>
- 1 回答
- 0 關(guān)注
- 212 瀏覽
添加回答
舉報
0/150
提交
取消