We have given the data in CSV file format and the task is to display the CSV file data into the web browser using PHP. To display the data from CSV file to web browser, we will use fgetcsv() function.
Comma Separated Value (CSV) is a text file containing data contents. It is a comma-separated value file with .csv extension, which allows data to be saved in a tabular format.
fgetcsv() Function: The fgetcsv() function is used to parse a line from an open file, checking for CSV fields.
- Open XAMPP server and start apache service
- Open notepad and type the PHP code and save it as code.php
- Store the CSV file in the same folder. Like xampp/htdocs/gfg/a.csv
- Go to browser and type http://localhost/gfg/code.php.