我正在生成一个CSV文件但正在处理这些文件的人告诉我它需要是ASCII格式的?我该怎么做呢?
这是我生成文件的原因:
$filename = '/logs/'.date('Ymd').'.txt';
$myfile = fopen($filename,'a');
fwrite($myfile, $data);
fclose($myfile);
此文件生成正常并打开正常......肉眼看来一切都好,但他们说它需要采用ascii格式...
文件输出:
"","932-4","Mike","Tanner","","1234 Testing Lane","","Los Angeles","CA","90066","","(993)857-7727","","","","SALE","","","V","4111111111111111","01/14","AXLW","","ZENC","","","REG","","511.80","","07/21/11","932-359","D1234","4","","1","","","","","","","Tanner","Mike","","1234 Testing Lane","","CA","Los Angeles","90066","","CC","","","","Y","100.00","","100.00","","","","","","","","Y","11.8","info@info.com","359","001","001","(993)857-7727","(993)857-7727","","","","","","","","","","","","","","","","","","","","222","","","","","","","","","","","","","",
任何?
...谢谢
答案 0 :(得分:1)
我要播放Carnac the Magnificent并说你只是使用换行符(ascii 10,又名\ n)来终止每一行。我敢打赌他们想要回车加上换行(ascii 13,10)。只是一个疯狂的猜测。 :)
答案 1 :(得分:1)
ANSI = Windows-1252,可能是:$data = iconv("windows-1252","ASCII",$data);