1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
<?php
echo "<table>";
$fichier = "monfichier.csv";
$fic = fopen($fichier, 'rb');
$nb_lignes=0; //Init du nombre de lignes
$tab_lignes=array(2,3,9,10,11,12); //Gestion des lignes dans un tableau
$tab_colonnes=array(1,3,7); //Gestion des colonnes dans un tableau
for ($ligne = fgetcsv($fic, 1024, ";"); !feof($fic); $ligne = fgetcsv($fic, 1024, ";")) {
if(in_array($nb_lignes,$tab_lignes)){
echo "<tr>";
$j = sizeof($ligne);
for ($i = 0; $i < $j; $i++) {
if(in_array($i,$tab_colonnes)){
echo "<td>".$ligne[$i]."</td>";
}
}
echo "</tr>";
}
$nb_lignes++;
}
echo "</table>\n";
?> |
Partager