【发布时间】:2013-06-11 05:26:58
【问题描述】:
我已使用以下代码将模板文件加载到内存中:
t := template.New("master")
tpl, err := t.ParseFiles("templates/index.html")
现在我想将该模板绘制成一个字符串,所以我的index.html 很空:
{{define "master"}}
Hello World
{{end}}
我刚刚开始,所以我还没有任何数据。有没有办法可以将Template 对象转换为没有数据的字符串?
【问题讨论】:
标签: go