Definition and usage
The readfile () function outputs a file.
This function reads a file and writes it to the output buffer.
If yes, the number of bytes read from the file is returned. If it fails, false is returned. You can call this function in the form of @ readfile () to hide the error message.
Syntax
Readfile (Filename,Include_path,Context)
Parameters |
Description |
Filename |
Required. Specifies the file to be read. |
Include_path |
Optional. If you wantInclude_pathYou can use this parameter and set it to true. |
Context |
Optional. Specifies the file handle environment.ContextIs a set of options that can modify the behavior of a stream. |
Description
PairContextThe supported parameters are added in PHP 5.0.0.
Tips and comments
Tip: If "fopen wrappers" has been activated in the PHP. ini file, you can use the URL as the file name in this function.
Example
<? Phpecho readfile ("test.txt");?>
Output:
There are two lines in this file. This is the last line.57