我正在使用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