php – 无法加载资源:帧加载中断 – Agian

前端之家收集整理的这篇文章主要介绍了php – 无法加载资源:帧加载中断 – Agian前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有从虚假链接下载图片代码.我看过其他评论/网站,但没有任何帮助我找到烦人的解决方案:

“无法加载资源:帧加载中断”

我的PHP标题是在我读取GET值之后:

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);

我有jQuery脚本调用iframe下载文件

$('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');

这将工作;-)

猜你在找的PHP相关文章