为了账号安全,请及时绑定邮箱和手机立即绑定

老师您好 能帮我看看问题在哪儿么?

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>

https://img1.sycdn.imooc.com//5be4108800016ba519400632.jpg


https://img1.sycdn.imooc.com//5be41099000198e914080398.jpg



正在回答

2 回答

模板文件位置换成绝对路径就可以了

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

老师您好 能帮我看看问题在哪儿么?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信