php – 尝试在Internet Explorer中下载xlsx 2007文件
发布时间:2020-12-13 16:16:32 所属栏目:PHP教程 来源:网络整理
导读:xlsx文件无法在IE中下载但在Firefox中正常工作 ???我的代码是 $objPHPExcel-setActiveSheetIndex(0);// Redirect output to a client’s web browser (Excel2007)header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
xlsx文件无法在IE中下载但在Firefox中正常工作
???我的代码是 $objPHPExcel->setActiveSheetIndex(0); // Redirect output to a client’s web browser (Excel2007) header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header("Content-Disposition: attachment;filename='Monthly-Report-$month-$year'"); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel,'Excel2007'); $objWriter->save('php://output'); //$objWriter->save(str_replace('.php','.xlsx',__FILE__)); exit; 错误消息在IE中显示为 解决方法
是的,如果您使用的是HTTPS,那么Internet Explorer就会出现问题.在处理文件下载时,您需要从响应中删除Pragma标头.
在下载之前输入以下代码: header("Pragma: "); 只有当您使用安全的http运行时才会出现这种情况,如果情况并非如此,请告知我们. 您可能会在我的博客文章中找到更多描述,当我遇到与https相同的问题时,我错了,因为它在IE上完美适用于http. http://blogs.digitss.com/programming/internet-explorer-was-not-able-to-open-this-internet-site-the-requested-site-is-either-unavailable-or-cannot-be-found/ 我希望这有帮助. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |