Web Masters Site All For Web Masters

13Aug/080

Read From Files In PHP

Read from open file can be done with function fread

  • string fread(int file, int length)

This function returning string with size of length from file which you want to read, for example

<?
 
$file = fopen("c:\file.txt", "r"); // File which must be opened
 
if(!$file) //if file have not been loaded
 
{
 
echo "Error";
 
}else{
 
$buff = fread($file, 100); // Read from $file(file.txt) maximum 100 characters
 
print $buff; // Print content of file which was read
 
}
 
?>
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

 

No trackbacks yet.