mhafizhasan
10/7/2017 - 2:48 PM

Read CSV

Read CSV

Open CSV file

$file = fopen(FCPATH . 'docs/imports/temp/file_to_read.csv', 'r');

Read file and limit to 1000 rows

while(($csv_line = fgetcsv($file, 1000)) !== FALSE) {

  print_r($csv_line);     // print whole row value
  
  echo $csv_line[0];      // print value for 1st column

}