Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

readfile

Description

The readfile Filesystem for PHP outputs a file.

Syntax

readfile(
    string $filename,
    bool $use_include_path = false,
    ?resource $context = null
): int|false

Parameters

filename

The filename being read.

use_include_path

You can use the optional second parameter and set it to true, if you want to search for the file in the include_path, too.

context

A context stream resource.

Return

Returns the number of bytes read from the file on success, or false on failure.

Examples

1 · filename

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';

readfile($filename);

?>
hello

2 · return

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';

$return = readfile($filename);

echo $return;

?>
hello5
HomeMenu