&引用;无法下载文件";在IE.PHP标题中
尝试下载文件时,chrome/firefox上的一切都可以正常工作。但是,如果在IE10中尝试下载该文件,则会在IE上显示以下错误消息:&引用;无法下载文件";在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
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返回除内容类型
内容配置
和内容长度