Quick Search:
 
 PHP Code: Get file in as variable Jump to:  
Category: >> PHP Code >> Get file in as variable  

<< lastnext >>

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);
 
?> 
 
 


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org