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:
?
2 3
4 56 |
$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 4 | $fh = fopen("contacts.csv", "r"); while($line = fgetcsv($fh, 1000, ",")) { echo "Contact: {$line[1]}"; } |