PHP导出EXCEL文件时总是自动打开,请问如何防止?
<code class="lang-php"> header("Content-Type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: attachment; filename=$outputFileName"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); $xlsWriter->save("php://output");</code>
回复内容:
PHP导出EXCEL文件时总是自动打开,请问如何防止?
<code class="lang-php"> header("Content-Type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: attachment; filename=$outputFileName"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); $xlsWriter<div style="color:transparent">本&文来源gaodai^.ma#com搞#代!码网</div><strong>搞gaodaima代码</strong>->save("php://output");</code>
改成
<code>header('Content-Type: application/octet-stream');</code>