PHP/HTML/HTML File

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

fgetss: Gets line from file pointer and strip HTML tags

<?php
   $tags = "<h2><h3><p><b><a><img>";
   $fh = fopen("demo.htm", "rt");
   while (!feof($fh)) {
      $article .= fgetss($fh, 1024, $tags);
   }
   fclose($fh);
   /* Open the file up in write mode and write $article contents. */
   $fh = fopen("demo.html", "wt");
   fwrite($fh, $article);
   fclose($fh);
   
   echo $article;
?>

<!--
<html>
<body>
body
<p>paragraph</p>
</body>
</html>
-->