html/template: “templates/users/user.tmpl” is undefined
对于这类报错由于未找到模板导致的,所以需要在模板中的开头进行命名,在main.go文件中与其相对应。
在模板开头添加
{{define “name”}}
在模板最后添加{{end}}
注意:此处的name需要与main.go中的渲染模板处的name相对应,否则仍然找不到模板
html/template: “xxxxxxxx“ is undefined
最新推荐文章于 2024-05-25 16:27:24 发布