html
download.php
$id = $_GET['id'];
$sql="SELECT `name`,`path` FROM `table` WHERE `id`='$id'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
if(file_exists($row['path'])){
$file = fopen($row['path'], 'r');
header('Content-Type: application/octet-stream');
header('Accept-Ranges: bytes');
header('Accept-Length: '.filesize($row['path']));
header('Content-Disposition: attachment; filename='.$row['name']);
echo fread($file, filesize($row['path']));
fclose($file);
}else{
echo '指定的文件不存在';
}
?>
最简单的就是,直接一个a标签,链接填上到压缩包的地址,就能下载了