PHP将结果从我的数据库导出到CSV
我无法将数据导出到cvs文件 我的问题与此相同 我已经使用了建议的解决方案,但问题依然存在 我在excel 2013和excel 2007上测试了它 我想用excel自动打开文件PHP将结果从我的数据库导出到CSV,php,csv,Php,Csv,我无法将数据导出到cvs文件 我的问题与此相同 我已经使用了建议的解决方案,但问题依然存在 我在excel 2013和excel 2007上测试了它 我想用excel自动打开文件 header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=cars.csv'); header('Cache-Control: no-cache, no-store, must-revalidat
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=cars.csv');
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');
$csvoutput = fopen('php://output', 'w');
//$str="sep=,";
//fputcsv($csvoutput,$str );
//echo "sep=,\r\n";
此解决方案不起作用,因为它在php脚本中有空行。 因此,有必要删除所有的空间,以便
echo "sep =, \ r \ n";
这是第一个