Easy Tutorial
❮ Func Date Gmstrftime Func String Printf ❯

PHP readfile() Function



Definition and Usage

The readfile() function reads a file and writes it to the output buffer.

If successful, the function returns the number of bytes read from the file. If it fails, the function returns FALSE and an error message. You can hide the error output by adding an '@' before the function name.

Syntax

Parameter Description
filename Required. Specifies the file to read.
include_path Optional. Set this parameter to '1' if you want to search for the file in the include_path (specified in php.ini).
context Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of the stream.

Tips and Notes

Tip: If "fopen wrappers" in the php.ini file are enabled, you can use URLs as file names in this function.


Example

The above code will output:


❮ Func Date Gmstrftime Func String Printf ❯