Home > Article > Backend Development > PHP4 User Manual: Function-file_PHP Tutorial
file
(PHP 3, PHP 4 >= 4.0.0)file -- Read the entire file into an array description
array file (string filename [, int use_include_path])
except file() What is returned is an array, and the rest is the same as the website construction server script class PHPPHP user manual fancyfunction.readfile.html>readfile(). Each element of the array corresponds to each line of the file, with newlines.
Note: Each row in the result array contains line endings. If you don't want the line endings you can use the trim() function to remove them.
If you want to search for files in the include path, you can use the optional second parameter and set it to "1".
Line $line_num:; ", htmlspecialchars ($line), "
";}// Get a web page into a string $fcontents = join (, file (http://www.php.net/));?>
Warning
This function cannot be used for binary!
Tip: If the "fopen wrappers" configuration is turned on, you can use the URL as the file name in this function