Supprimer des lignes en debut de fichier

obelix3200 Messages postés 8 Date d'inscription samedi 5 octobre 2002 Statut Membre Dernière intervention 2 novembre 2002 - 5 oct. 2002 à 01:25
obelix3200 Messages postés 8 Date d'inscription samedi 5 octobre 2002 Statut Membre Dernière intervention 2 novembre 2002 - 9 oct. 2002 à 17:29
Je voudrait supprimer les 20 premieres ligne d'un fichier HTML, je n'ai absolument aucune idee la...
un ptit coup de pouce ?
merci d'avance .

2 réponses

cs_Mcjo Messages postés 403 Date d'inscription dimanche 12 août 2001 Statut Membre Dernière intervention 3 septembre 2012 2
9 oct. 2002 à 01:37
<?
$ligne = 0;
$texte = '';
$pfichier = fopen ("mon_fichier.html", "r");
while ($a = fgets($pfichier , 4000)) {
$ligne = $ligne + 1;
if ($ligne > 20) {
$texte = $texte.$a;
}
echo(" $ligne: $texte
");
}
echo("
$texte");
fclose($pfichier);
unlink("mon_fichier.html");
$pfichier = fopen ("mon_fichier.html", "w+");
fwrite($pfichier ,$texte);
?>

mais il y a peut-etre plus efficace je debute le php
0
obelix3200 Messages postés 8 Date d'inscription samedi 5 octobre 2002 Statut Membre Dernière intervention 2 novembre 2002
9 oct. 2002 à 17:29
merci bcp, jvé tester ;)
@+
0
Rejoignez-nous