php下载文件,添加响应头的简单实例

2019-11-13,,

如下所示:

//下载,添加响应头信息
header('Content-type:application/octet-stream');
header('Content-Disposition:attachment;filename="'.basename($file).'"');
header('Content-Length:'.filesize($file));
readfile($file);

以上就是小编为大家带来的php下载文件,添加响应头的简单实例的全部内容了,希望对大家有所帮助,多多支持北冥有鱼~

《php下载文件,添加响应头的简单实例.doc》

下载本文的Word格式文档,以方便收藏与打印。