我使用此代码从 CSV 文件中获取列数:
$this->dummy_file_handler = fopen($this->config['file'],'r');
if ($dataset =fgetcsv($this->dummy_file_handler))
{
$this->number_of_columns = count($dataset);
}
除非使用 Excel for Mac 2011 导出文件,否则它工作正常,因为换行符是 无法识别的经典 Mac (CR) 。fgetcsv
If I manually change the newline from Classic Mac (CR) to Unix (LR), then it works, but I need this to be automated.
How can I make fgetcsv
recognize the Classic Mac (CR) new line character?