用go 实现下载功能

SLonger · 2016-07-14 09:10:35 · 5897 次点击

试试这个

package main import ( "net/http" ) func main() { http.Handle("/", http.FileServer(http.Dir("./"))) http.ListenAndServe(":8123", nil) }

不行就自行百度golang 文件服务器

#1
更多评论

你说的应该就是静态服务器吧

#2

恩, 解决了,用了ServeFile() 实现服务器文件下载,上面个代码好像只能在网页上打开,没法下载,非常感谢^.^

#3