File
(PHP 3, PHP 4> = 4.0.0) FILE - Read the entire file to array
description
Array file (string filename [, int us_include_path])
In addition to file () returns an array, others are the same as readfile (). Each element of the array corresponds to each line of the file, and has a wrap.
Note: Each line in the result array contains a row, if you don't want to do the end, you can use the Trim () function to remove it.
If you want to search for files in the path, you can use optional second parameters and set it to "1".
PHP
// Get an array of a webpage and print it
$ FCONTENTS = file ('http://www.php.net/');
While (List ($ line_num, $ line) = Each ($ fcontents)) {
echo " line $ line_num: b>;", HTMLSPECIALCHARS ($ LINE), "
/ n";
}
// Get a web page to the string
$ fcontents = JOIN ('', file ('http://www.php.net/');
?>
WARNING This function cannot be used for binary!
Tip: If the "Fopen Wrappers" configuration is already open, you can use the URL as a file name in this function.
See readfile (), fopen (), fsockopen (), and popen ().