go語言http服務處理image/css/js等靜態文件

go語言實現http服務器時若是處理靜態文件,須要用到http.ServeFile:服務器   func ServeFile(w ResponseWriter, r *Request, name string) { dir, file := filepath.Split(name) serveFile(w, r, Dir(dir), file, false)} 首先根據請求路徑r.URL.Path
相關文章
相關標籤/搜索