php实现下载文件(浏览器不直接打开)
test.html:
<a href="do.php?ac=dw">下载12.jpg</a>
do.php:
if($_GET['ac']=='dw') {
$file = './12.jpg'; //文件路径$filename = basename($file); //要下载文件的名字header("Content-Type: application/force-download");header("Content-Disposition: attachment; filename=".($filename));readfile($file);
}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。