When a CSV file is created on Mac, the line endings will not be identified by Apache when we use fgetcsv() or fgets().
The common line endings are:
\n (UNIX/Linux)
\n\r (Windows)
\r (Mac)
The best solution for this is to allow PHP to detect the line ending automatically... Follow one of the follwoing ways to solve this matter.
If it is php.ini
auto_detect_line_endings = On
If it is a php file
Put this line at the top of the php file before handling csv.
ini_set('auto_detect_line_endings', true);
Post a Comment
Post a Comment