<?php
ob_clean();
$filepath = '../systemdata/q.txt';
if(!file_exists($filepath)){
exit;
}
$fp=fopen($filepath,"r");
$filesize=filesize($filepath);
header("Content-type:application/octet-stream");
header("Accept-Ranges:bytes");
header("Accept-Length:".$filesize);
header("Content-Disposition: attachment; filename=".basename($filename));
$buffer=1024;
$buffer_count=0;
while(!feof($fp)&&$filesize-$buffer_count>0){
$data=fread($fp,$buffer);
$buffer_count+=$buffer;
echo $data;
}
fclose($fp);
?> 最佳答案