fopen( ) and fread( ) : fread « File Directory « PHP






fopen( ) and fread( )

 
<?
    
    $filename = 'data.txt';
    $fh_flowers = fopen("data.txt", "r") OR die ("Can't open the file!\n");
    $fh_logfile = fopen("$appname-log.log", "w") OR die ("Log file not writeable!\n");

    $handle = fopen($filename, "a");
    if (!$handle) {
            print "Failed to open $filename for appending.\n";
    }
?>
  
  








Related examples in the same category

1.Reading a file
2.fread( ) is good for when you only care about a small part of the file.
3.fread() function reads up to length bytes from the file, returning the file's contents.
4.fread.php
5.Reading and Writing Binary Data in a File