Snippet Name: Get file in as variable
Description: You can read the whole content of a file into a variable with this statement.
Comment: (none)
Language: PHP
Highlight Mode: PHP
Last Modified: February 27th, 2009
|
<?PHP
// get contents of a file into a string
$filename = "/usr/local/something.txt";
$handle = FOPEN($filename, "r");
$contents = FREAD($handle, FILESIZE($filename));
FCLOSE($handle);
?>
|