readfile
Output file
readfile()
function outputs a file.
This function reads into a file and writes to the output buffer.
If successful, return the number of bytes read from the file. If it fails, return false. You can call the function in the form of @readfile() to hide the error message.
<?php echo readfile("test.txt"); ?>
输出:
There are two lines in this file. This is the last line. 57
readfile ( filename , include_path , context )
parameter | describe |
---|---|
filename | Required. Specifies the file to be read. |
include_path | Optional. If you also want to search for files in include_path , you can use this parameter and set it to true. |
context | Optional. Specifies the environment for file handles. Context is a set of options that can modify the behavior of a stream. |
Support for context parameters is added by PHP 5.0.0.