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

				
					<?php
echo readfile('test.txt');
?>
				
			

Output

				
					// reads the content of the file
				
			

Syntax

				
					readfile(file, include_path, context)
				
			

Parameters

ParameterDescription
fileSpecifies the file to read (required)
include_pathSet this parameter to TRUE if you want to search for the file in the include_path (in php.ini) as well
contextSpecifies the context of the file handle; context is a set of options that can modify the behavior of a stream