<?php $file = './test.png'; $filename = basename($file); //設置頭信息 header("Content-Type:application/octet-stream"); header("Content-Disposition:attachment;filename='$filename'"); header("Content-Transfer-Encoding:binary"); //輸出文件內容 $handle = fopen($file,'r'); $content = fread($handle, filesize($file)); echo $content; fclose($handle);*