Read all data from current position in file, until EOF, and writes the result to the output buffer in PHP

Description

The following code shows how to read all data from current position in file, until EOF, and writes the result to the output buffer.

Example


/* w w w .j  a v a2  s. c o m*/
 
<?php
    $file = fopen("test.txt","r");
    
    // Read first line
    fgets($file);
    
    // Send rest of the file to the output buffer
    echo fpassthru($file);
    
    fclose($file);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    File »




Directory
DirectoryIterator
Drive
File
File Permission
File Read Save
FileSystemIterator
Path
Zip