我提供下面的 html 模板的方式有問(wèn)題嗎?頁(yè)面上沒(méi)有顯示任何內(nèi)容。推特.go:func loghandler(w http.ResponseWriter, r *http.Request) { t := template.Must(template.New("tele").ParseFiles("layout/log.html")) t.Execute(w, nil)}日志.html:<html> <form action="/login" method="POST"> <label for="name">Username</label> <input type="text" id="Username" name="name"></input> <button type="submit">Login</button> </form> </html>目錄結(jié)構(gòu):twitter layout log.htmltwitter.go
2 回答

白板的微信
TA貢獻(xiàn)1883條經(jīng)驗(yàn) 獲得超3個(gè)贊
使用像這樣簡(jiǎn)單的東西:
func loghandler(w http.ResponseWriter, r *http.Request) {
t,_ := template.ParseFiles("layout/log.html")
t.Execute(w, nil)
}
我已經(jīng)試過(guò)了,它有效。
- 2 回答
- 0 關(guān)注
- 192 瀏覽
添加回答
舉報(bào)
0/150
提交
取消