我正在使用以下php代码生成csv文件:
header("Expires: 0");
header("Cache-control: private");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Description: File Transfer");
header("Content-Type: text/csv");
header("Content-disposition: attachment; filename=site_list.csv");
CSV文件在所有浏览器中都已成功生成。但是ie生成的文件,当用ms excel打开时,所有的数据都显示在一行中。
PS:
其他浏览器(FF、Google Chrome)生成的文件运行良好。
我用“\n”表示换行符。
使用“\r\n”没有帮助
最佳答案
你试过用\r\n
作为你的换行符吗?我知道有些版本的ie在返回时有一些奇怪的问题。