在 html 上书写时没有显示图像。 i can display only image writing on main.go (parsefile). but writing on html image didnt show.我试过 html/模板。它也不起作用。代码:_base.html <!DOCTYPE html> <html>`enter code here` <head> <title>{{ template "title" . }}</title> </head> <body> <section id="contents"> {{ template "content" . }} </section> <footer id="footer"> My Cool Guestbook 2000 © me forever </footer> </body> </html> code:(index.html) {{ define "title" }}Guestbook{{ end }} {{ define "content" }} <h1>Guestbook</h1> <p>Hello, and welcome to my guestbook, because it's 1997!</p> <ul class="guests"> <li>...</li> </ul> <img src="image.png"> {{ end }}代码:(main.go 某些部分)var index = template.Must(template.ParseFiles( "templates/_base.html", "templates/index.html",))func hello(w http.ResponseWriter, req *http.Request) { if err := index.Execute(w, nil); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) }}func main(){ 等...Web 应用程序工作正常。但图像没有显示
目前暂无任何回答
- 0 回答
- 0 关注
- 243 浏览
添加回答
举报
0/150
提交
取消