PHP/File Directory/readfile

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

readfile() function reads in a file and outputs it to standard output.

 
Its syntax is: int readfile (string file [, int use_include_path])
<?
    $restaurant_file = "data.txt";
    print readfile($restaurant_file);
?>



readfile.php

 
<?php
   $file = "data.txt";
   $tags = "<h2><h3><p><b><a><img>";
   $fh = fopen($file, "rt");
   while (!feof($fh))
      $article .= fgetss($fh, 1024, $tags);
   fclose($fh);
   $fh = fopen($file, "wt");
   fwrite($fh, $article);
   fclose($fh);
   $bytes = readfile($file);
?>