%% Width100 % (PHP3, PHP44.0.0) file -- read the entire file to the array description arrayfile (stringfilename [, intuse_include_path]). In addition to file (), The Returned values are arrays () same. Each document corresponding to each element in the array
TABLE border = 0 cellPadding = 0 cellSpacing = 0 height = "100%" width = "100%">
(PHP 3, PHP 4> = 4.0.0)
File -- read the entire file to the array
Description
Array file (string filename [, int use_include_path])
In addition to the array returned by file (), the other values are the same as those returned by readfile. Each element of the array corresponds to each row of the file, with a line break.
Note: Each row in the result array contains the end of the row. if you do not want the end of the row, you can use the trim () function to remove it.
If you want to search for files in the include path, you can use the optional second parameter and set it to "1 ".
// Obtain an array of web pages and print it
$ Fcontents = file ('http: // www.php.net /');
While (list ($ line_num, $ line) = each ($ fcontents )){
Echo"Line $ line_num:; ", Htmlspecialchars ($ line ),"
\ N ";
}
// Obtain a webpage to the string
$ Fcontents = join (', file ('http: // www.php.net /'));
?>
Warning
This function cannot be used in binary format!
Tip: If the "fopen wrappers" configuration has been enabled, you can use URL as the file name in this function.
See readfile (), fopen (), fsockopen (), and popen ().