我有从虚假链接下载图片的代码.我看过其他评论/网站,但没有任何帮助我找到烦人的解决方案:
“无法加载资源:帧加载中断”
header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: private",false); // required for certain browsers //header('Content-Length: '. @filesize($id)); header('Content-Type: '.$mim); header('Content-Disposition: attachment; filename="'.$date.basename($fileName).'"'); header('Content-Transfer-Encoding: binary'); header('Cache-Control: must-revalidate,post-check=0,pre-check=0'); readfile($fileName);
$('body').append('<iframe class="download" src="download.PHP?id='+downloading+'" style="visibility:hidden;" width="0" height="0"></iframe>');
header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate,pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header("Content-type: application/x-unknown"); // I always use this header("Content-Disposition: attachment; filename='theFilename.ext'"); header("Content-Transfer-Encoding: binary"); header("Content-Length: 177998"); // you might want to set this readfile('/the/url/to/theFilename.ext');
这将工作;-)