从网上找到一个简单的版本:

<?php

$filename = $_GET['file'].”.filetype”;
header(“Content-Type: application/force-download”);
header(“Content-Disposition: attachment; filename=”.basename($filename));
readfile($filename);
?>