Page 1 of 1

How to open a file using PHP

Posted: Sun Nov 29, 2009 3:15 am
by Tony

Code: Select all

<? 
$filename = "delete.htm"; // This is at root of the file using this script.
$fd = fopen ($filename, "r"); // opening the file in read mode
$contents = fread ($fd, filesize($filename)); // reading the content of the file
fclose ($fd);               // Closing the file pointer
echo $contents;              // printing the file content of the file
?>