经测试代码如下:
/**
* 下载图片弹出下载窗口
*
* @param
* @arrange (512.笔记) jb51.cc
**/
$file = $_GET['file'];
header ("Content-type: octet/stream");
header ("Content-disposition: attachment; filename=".$file.";");
header("Content-Length: ".filesize($file));
readfile($file);
exit;
// In your html
<a href="process.PHP?file=pic.jpg">Image goes Here</a>
原文链接:https://www.f2er.com/php/528825.html