我一直在使用PHP脚本将数据从我的数据库(mysql)导出到XLS文件.
虽然文件导出过程在Firefox和IE上运行良好.
尝试使用Google Chrome导出时出错.
谷歌浏览器错误是
Duplicate headers received from server
The response from the server contained duplicate headers. This problem is generally the result of a misconfigured website or proxy. Only the website or proxy administrator can fix this issue.
Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple distinct Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.
Run Code Online (Sandbox Code Playgroud)
我需要一些帮助.
谢谢
Sta*_*umo 11
我已经在PHP导出代码的标题部分找到了我的问题.错误和正确的行如下:
不正确
header("Content-Disposition: attachment;filename=\"".$this->filename."\"");
Run Code Online (Sandbox Code Playgroud)
正确
header("Content-Disposition: attachment; filename=\"".$this->filename."\"");
Run Code Online (Sandbox Code Playgroud)
修正是在附件之间增加一个空格; 和文件名
希望这可以帮助.
我有同样的问题.但是很少出现.原因相似但不完全相同.
不正确
header("Content-Disposition: attachment; filename=$filename");
Run Code Online (Sandbox Code Playgroud)
正确
header("Content-Disposition: attachment; filename=\"$filename\"");
Run Code Online (Sandbox Code Playgroud)
$ filename有时包含空格,导致提及Chrome错误.
归档时间: |
|
查看次数: |
6976 次 |
最近记录: |