![](https://static.studygolang.com/200415/353e4daa8f1454715b1deb31ac87c289.png)
image.png
** index.tmpl **
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>修改模板引擎的标识符</title>
<link rel="stylesheet" type="text/css" href="/staticbert/index.css" />
</head>
<body>
<h1>2134</h1>
<div>{{ . }}</div>
</body>
</html>
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.Static("/staticbert", "./static")
r.LoadHTMLFiles("./index.tmpl")
r.GET("/index", func(c *gin.Context) {
c.HTML(200, "index.tmpl", nil)
})
r.Run(":2221")
}
![](https://static.studygolang.com/200415/9dbe13481e4e9d6fed096e508eb3d5df.png)
image.png
![](https://static.studygolang.com/200415/fef58674848f95fdc95497c40f2769df.png)
image.png
有疑问加站长微信联系(非本文作者)
![](https://static.golangjob.cn/static/img/footer.png?imageView2/2/w/280)