test.html:
<a href="do.php?ac=dw">下載12.jpg</a>php
do.php:
if($_GET['ac']=='dw') {html
$file = './12.jpg'; //文件路徑 $filename = basename($file); //要下載文件的名字 header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".($filename)); readfile($file);
}app