How to read csv file using php.This is simple.PHP file methods/ functions can be use to this.fopen(),feof(),fgetcsv(),fclose() are use here.Following function will return after read the csv file.
- If your csv file is “|” delimiter you need to pass the delimiter as following.
$line_of_text = fgetcsv($file_handle, 1024, "|");
- PHP fgetcsv() function is return an array.It stops returning on a new line, at the specified length.
- If not read the all lines of csv file, keep the
in the top of the page.
- The 1000 means that specifies the maximum length of a line.
- PHP read file line by line.That means row by row.
- The result is array.Then you can understand that better.