Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php IE生成的CSV文件中未发生换行_Php_Internet Explorer_Csv - Fatal编程技术网

Php IE生成的CSV文件中未发生换行

Php IE生成的CSV文件中未发生换行,php,internet-explorer,csv,Php,Internet Explorer,Csv,我使用以下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

我使用以下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打开时,以单行显示所有数据

附言:

  • 其他浏览器(FF、Google Chrome)生成的文件运行良好
  • 我使用“\n”表示换行符
  • 使用“\r\n”没有帮助

您是否尝试过使用
\r\n
作为换行符?我知道有些版本的IE在回车时会出现一些奇怪的问题。

添加\r\n并且应该用双引号括起来

'Line 1' . "\r\n" . 'Line 2'