Valid XHTML    Valid CSS2    

Listing du fichier litfic.php

 

00001     <?php echo"<?xml version='1.0' encoding='ISO-8859-1' ?>\n" ; ?>
00002     
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
00003     <html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
00004     <head>
00005     <title>
00006     Exemple de lecture d'un fichier en PHP
00007     </title>
00008     </head>
00009     <body background="beige.jpg">
00010     <p>&nbsp;</p>
00011     <h1>Exemple de lecture d'un fichier en PHP</h1>
00012     <h1>Lecture et affichage "tel quel" du fichier <a href="brut.txt">brut.txt</a></h1>
00013     <blockquote>
00014     <pre>
00015     <?php
00016     
00017      $fh
=
fopen("brut.txt","r") ;
00018     
$nbl
= 0 ;
00019     
00020      while (!
feof
($fh)) {
00021     
$lig
= fgets($fh, 4096) ;
00022      if (
strlen
($lig)>0) {
00023     
$nbl++ ;
00024      echo
"
$nbl : $lig\n" ;
00025      } ;
# fin si
00026     
} ; # fin tant que
00027     
00028     
fclose
($fh) ;
00029     
00030     
00031     
?>
00032     
</pre>
00033     
00034     <!--- ================ -->
00035     
00036     <!--- ================ -->
00037     
00038     <p>&nbsp;</p>
00039     <p>
00040     <a href="http://www.info.univ-angers.fr/pub/gh/"><img src="return.gif" alt="retour gH" /></a>
00041     &nbsp;&nbsp;&nbsp;Retour à la page principale de &nbsp;
00042     <font color="#008800">(gH)</font>
00043     </p>
00044     <p>&nbsp;</p>
00045     
00046     </blockquote>
00047     </body>
00048     </html>

Pour ne pas voir les numéros de ligne, ajoutez &nl=non à la suite du nom du fichier.

 

 

retour gH    Retour à la page principale de   (gH)