PHP/File Directory/fgetss

Материал из Web эксперт
Перейти к: навигация, поиск

fgetss.php

   <source lang="html4strict">

<?php

$tags = "

<a><img>"; $fh = fopen("article.html", "rt"); while (!feof($fh)) { $article .= fgetss($fh, 1024, $tags); } fclose($fh); $fh = fopen("article.html", "wt"); fwrite($fh, $article); fclose($fh); ?> </source>

fgetss() strips all HTML and PHP tags from the file: string fgetss (int filepointer, int length [, string allowable_tags])

   <source lang="html4strict">

<? $fh = fopen("data.txt", "r"); while (!feof($fh)) :

  print fgetss($fh, 2048);

endwhile; fclose($fh); ?>

 </source>
   
  


Stripping all but a select few tags from an HTML file

   <source lang="html4strict">

<? $fh = fopen("data.txt", "r"); $allowable = "
"; while (!feof($fh)) :

   print fgetss($fh, 2048, $allowable);

endwhile; fclose($fh); ?>

 </source>