如何防止转义'到'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 关注
- 180 浏览
添加回答
举报
0/150
提交
取消