当前位置: 首页 > 文档资料 > DoitPHP 帮助文档 >

6.14 FileDownload使用说明

优质
小牛编辑
116浏览
2023-12-01

DoitPHP的扩展类FileDownload,仅用于文件下载。

类方法使用说明:

1、getData($file, $rename = null)

http下载文件。 读取文件然后以浏览器header的方式下载。注:支持静态调用。

参数说明:
$file : 所要下载的文件路径
$rename : 文件重命名后的名称

举例说明:

例一、文件下载

Controller文件代码内容如下:

public function indexAction() {

$filePath = '/home/tommy/doitphp_v3.1.tar.gz'
FileDownload::getData($filePath);
}