慕斯卡3162337
2018-11-08 18:32
package main
import (
"github.com/kataras/iris"
)
func main() {
app := iris.New()
app.RegisterView(iris.HTML("./views", ".html"))
app.Get("/", func(ctx iris.Context) {
ctx.ViewData("message", "Hello world!")
ctx.View("hello.html")
})
app.Run(iris.Addr(":8080"))
}<html>
<head>
<title>Hello Page</title>
</head>
<body>
<h1>{{.message}}</h1>
</body>
</html>

模板文件位置换成绝对路径就可以了
iris+xorm Go语言开发球星库
7931 学习 · 53 问题
相似问题