import ( "fmt" "net/http" ) func main() { h := http.FileServer(http.Dir("./")) http.ListenAndServe(":1789", ce(h)) } func ce(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Println(r.URL.Path) h.ServeHTTP(w, r) }) }
有疑问加站长微信联系(非本文作者)