Home >Backend Development >PHP Tutorial >How to read csv files and output them in php_PHP tutorial

How to read csv files and output them in php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:03:191065browse

How to read and output csv files in php

This article describes the method of reading and outputting csv files in php. Share it with everyone for your reference. The specific implementation method is as follows:

<?php
$row = 0;
$j = 1; // Linea por la que quieres empezar
$file = "name.txt"; //Nombre del fichero
if (($handle = fopen($file, "r")) !== FALSE) {
 while (($data = fgetcsv($handle, ",")) !== FALSE) {
   print_r($data);
   $j++;
   $row++; 
 }
}
?>

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/969330.htmlTechArticleHow to read csv files and output them using php. This article describes how to use php to read csv files and output them. Share it with everyone for your reference. The specific implementation method is as follows: ?php$row = 0;$j = 1; /...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn