Home >Backend Development >PHP Tutorial >PHP reads csc file and outputs_PHP tutorial

PHP reads csc file and outputs_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 09:53:121131browse

php reads the csc file and outputs it

This article will share with you the method of php reading the csc file and outputting it. The first method uses the fgetcsv function, and the second method uses Here is the fopen function, friends in need can refer to it.

Method 1:

ใ€€?

1

2

3

4

5

6

7

8

9

10

11

12

$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 ;

}

}

?>

1

2

3

1

2

3

4

$fh = fopen("contacts.csv", "r");

while($line = fgetcsv($fh, 1000, ",")) {

echo "Contact: {$line[1]}";

}

4

5

6

8 9 10 11 12
$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 ;<๐ŸŽœ> <๐ŸŽœ>}<๐ŸŽœ> <๐ŸŽœ>}<๐ŸŽœ> <๐ŸŽœ>?>
Method 2: ใ€€?
1 2 3 4 $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. http://www.bkjia.com/PHPjc/1003830.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1003830.htmlTechArticlephp reads csc files and outputs. This article will share with you the method of php reading csc files and outputting. The first method uses the fgetcsv function, and the second method uses the fopen function. Friends who need it...
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