使用 README 中的示例 golang gin 代码:
func main() {
router := gin.Default()
router.LoadHTMLGlob("templates/*")
router.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.tmpl",
gin.H{
"foo": "bar",
})
}
}
// in template index.tmpl
<script>
{{.foo}}
</script>
// result in html
<script>
"bar"
</script>
但是如果没有引号我怎样才能得到它,我只需要barvs "bar"?
qq_遁去的一_1
相关分类