beego文件下載

beegon使用方法:this

自測使用的是GET請求,自動下載文件router

router添加路由路由

beego.Router("/file/down", &controllers.FileController{}, "get:FileDown")

controller添加下載文件方法get

this.Ctx.Output.Download("static/fil1.png")

Web界面下載文件的H5代碼route

<a href="/file/down" download="" > 下載文件</a>

使用效果:Web界面點擊下載文件後,會自動彈窗下載文件!file

相關文章
相關標籤/搜索