Go 官方库提供了两个模板库: text/template 和 html/template。这两个库类似,只不过 html/template对html格式做了特别的处理,当需要输出html格式的代码时需要使用html/template。
简单使用
package main
import (
"os"
"text/template"
)
type Student struct {
Name string
}
func main
Go 官方库提供了两个模板库: text/template 和 html/template。这两个库类似,只不过 html/template对html格式做了特别的处理,当需要输出html格式的代码时需要使用html/template。
package main
import (
"os"
"text/template"
)
type Student struct {
Name string
}
func main