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")
}
image.png
image.png
有疑问加站长微信联系(非本文作者)