您当前的位置: 首页 > 学无止境 > 心得笔记 网站首页心得笔记
原生php实现文件下载
发布时间:2017-08-01 15:49:45编辑:雪饮阅读()
<?php
$myfile = $_SERVER["DOCUMENT_ROOT"]."/VE-Update-1.5.0.zip";
$filename="VE-Update-1.5.0.zip";
$file = @ fopen($myfile, "r");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . $filename);
header('Content-Length:'.filesize($myfile));
while (!feof($file)) {
echo fread($file, 50000);
}
fclose($file);
?>
关键字词:php,文件下载
下一篇:mysql命令执行日志记录