您需要使用
http.StripPrefix处理程序:
http.Handle("/files/", http.StripPrefix("/files/", http.FileServer(http.Dir("."))))看到这里:http :
//golang.org/pkg/net/http/#example_FileServer_stripPrefix

您需要使用
http.StripPrefix处理程序:
http.Handle("/files/", http.StripPrefix("/files/", http.FileServer(http.Dir("."))))看到这里:http :
//golang.org/pkg/net/http/#example_FileServer_stripPrefix