Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 加载资源失败:帧加载中断-Agian_Php_Jquery - Fatal编程技术网

Php 加载资源失败:帧加载中断-Agian

Php 加载资源失败:帧加载中断-Agian,php,jquery,Php,Jquery,我有从假链接下载图片的代码。我看过其他评论/网站,但没有任何东西能帮助我找到解决恼人问题的方法: “加载资源失败:帧加载中断” 我的php头是在读取GET值之后生成的: header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: private",false); // required for certain browsers //header('Content-Length: '.

我有从假链接下载图片的代码。我看过其他评论/网站,但没有任何东西能帮助我找到解决恼人问题的方法:

“加载资源失败:帧加载中断”

我的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>');
$('body')。追加(“”);
我正确下载了文件,但在控制台中显示错误,请告诉我是否可以修复

header("Pragma: public"); // required
header("Expires: 0"); 
header("Cache-Control: must-revalidate, post-check=0, 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');

这将起作用;-)

好的,通过与vimeo的讨论,发现问题是由于内容处置:附件。他们告诉我这是一个与浏览器有关的问题。您不应该使用不同的DNS加载资源,因此它可以工作,但浏览器不会对此感到满意。

谢谢您的回复,内容长度与大小有关系吗。。如果文件大于177998怎么办?将内容长度设置为实际内容长度。。老实说,我实际上删除了所有的内容长度,脚本工作得很好。