【问题标题】:beego,redefined 404 page is show html source code ,why?beego,重新定义404页面是显示html源代码,为什么?
【发布时间】:2018-03-20 10:16:09
【问题描述】:

这是我的代码:

func page_not_found(rw http.ResponseWriter, r *http.Request){
    t,_:= template.ParseFiles(beego.BConfig.WebConfig.ViewsPath +"/404.html")
    data :=make(map[string]interface{})
    data["content"] = "page not found"
    t.Execute(rw, data)
}
func main() {
    beego.ErrorHandler("404",page_not_found)
    beego.Router("/", &controllers.MainController{})
    beego.Run()
}

我知道了:

【问题讨论】:

    标签: beego


    【解决方案1】:

    解决方法是用 utf-8 编码文件而不用 bom

    【讨论】:

      猜你喜欢
      • 2023-03-19
      • 2014-08-30
      • 1970-01-01
      • 2019-09-14
      • 2013-04-04
      • 2012-10-02
      • 2014-02-05
      • 2013-08-17
      • 1970-01-01
      相关资源
      最近更新 更多