例1:
当文件路径是“http”或者“ftp” 网址时,则源代码会有少许改变,见例2。
例2:
<?
$file_name = "info_check.exe";
$file_dir = "http://www.plcxue.com/";
$file = @ fopen($file_dir . $file_name,"r");
if (!$file) exit('文件找不到');
else {
Header("Content-type: application/octet-stream");
Header("Content-Disposition: attachment; filename=" . $file_name);
while (!feof ($file)) {
echo fread($file,50000);
}
fclose ($file);
}
?>