增加HTTP下载文件示例程序

This commit is contained in:
John
2018-11-10 16:18:50 +08:00
parent 463b35ed0d
commit 6ff44ad123
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,15 @@
package main
import (
"gitee.com/johng/gf/g"
"gitee.com/johng/gf/g/net/ghttp"
)
func main() {
s := g.Server()
s.BindHandler("/download", func(r *ghttp.Request){
r.Response.ServeFile("text.txt")
})
s.SetPort(8199)
s.Run()
}

View File

@ -0,0 +1 @@
下载文件内容。