Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/283.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
&引用;无法下载文件";在IE.PHP标题中_Php_Internet Explorer_Header - Fatal编程技术网

&引用;无法下载文件";在IE.PHP标题中

&引用;无法下载文件";在IE.PHP标题中,php,internet-explorer,header,Php,Internet Explorer,Header,尝试下载文件时,chrome/firefox上的一切都可以正常工作。但是,如果在IE10中尝试下载该文件,则会在IE上显示以下错误消息: test.xlsx couldn't be downloaded 如果我单击“重试”,它将成功下载。所以我不知道发生了什么。不知道这是我的代码的问题还是IE有这个bug 以下是用户尝试下载文件时我发送的标题: header('Content-Description: File Transfer'); header('Content-Type: applica

尝试下载文件时,chrome/firefox上的一切都可以正常工作。但是,如果在IE10中尝试下载该文件,则会在IE上显示以下错误消息:

test.xlsx couldn't be downloaded
如果我单击“重试”,它将成功下载。所以我不知道发生了什么。不知道这是我的代码的问题还是IE有这个bug

以下是用户尝试下载文件时我发送的标题:

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $doc_title.'"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));

请提供帮助

您是否尝试注释掉或删除“缓存控制”标题?这两个变量是否都正确?
$file
应该是
$doc\u title
还是反之亦然?不可以。它在chrome和firefox上运行良好。doc_title只是文件的字符串名称。$file是实际的文件路径,因此其上的filesize返回除
内容类型
内容配置
内容长度