1 Star 0 Fork 0

岳小威子 / space

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
download.php 829 Bytes
一键复制 编辑 原始数据 按行查看 历史
alan.yue 提交于 2021-03-21 13:33 . test
<?php
// 将发送到客户端的本地文件
$local_file=$path.$f;
$download_file=pathinfo($f)['basename'];
// 设置下载速率
$download_rate=get_info("download_max_speed");
if(file_exists($local_file)&&is_file($local_file)){
header('Cache-control: private');// 发送 headers
header('Content-Type: application/octet-stream');
header('Content-Length: '.filesize($local_file));
header('Content-Disposition: filename='.$download_file);
flush();// 刷新内容
$file=fopen($local_file,"r");
while (!feof($file)){
print fread($file,round($download_rate*1024));// 发送当前部分文件给浏览者
flush();// flush 内容输出到浏览器端
sleep(1);// 终端1秒后继续
}
fclose($file);// 关闭文件流
}else{
exit('404 File not found');
}
PHP
1
https://gitee.com/alan-yuewei/space.git
git@gitee.com:alan-yuewei/space.git
alan-yuewei
space
space
master

搜索帮助