我正在使用PHP从数据库查询创建CSV文件。 我运行查询,设置标题,并在Firefox中加载页面,文件提示下载并在Excel中打开,就像它应该的那样。 当我在IE中尝试它时,出现错误,说Internet Explorer cannot download ReportPrint.php from www.website.com.
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
不知道可以做什么来解决这个问题。使用PHP创建和下载CSV
header('Content-Description: File Transfer');
header("Content-Type: application/csv") ;
header("Content-Disposition: attachment; filename=Report.csv");
header("Pragma: no-cache");
header("Expires: 0");
echo "record1,record2,record3\n";
备注:“Expires”标题期望*日期* – 2010-09-17 19:55:09