Home >Backend Development >PHP Tutorial >PHP reads csc file and outputs it, _PHP tutorial

PHP reads csc file and outputs it, _PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:53:10858browse

php reads the csc file and outputs it,

Method 1:

<&#63;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++; 
 }
}
&#63;>

Method 2:

$fh = fopen("contacts.csv", "r");
while($line = fgetcsv($fh, 1000, ",")) {
  echo "Contact: {$line[1]}";
}

The above is the entire content of this article, I hope you all like it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1003992.htmlTechArticlephp reads the csc file and outputs it. Method 1: php$row = 0;$j = 1; // Linea por la que quieres empezar$file = "name.txt"; //Nombre del ficheroif (($handle = fopen($file, "r")) !== FAL...
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