PHP readfile Function

PHP readfile Function


Define :

In this tutorial we have learned about how to read file in php.The readfile() Function is inbuilt funciton in php.This function reads a file and writes it to the output buffer.

Syntax
  readfile(filename, use_include_path, context)
Parameters
filename Required. Specify the file to read.
use_include_path Optional. Set this parameter to true, if you want to search for the file in the include_path too. include_path can be set in php.ini.
context Optional. Specify a context stream resource. Context is a set of options that can modify the behavior of a stream.

Assume that we have a file "demo.txt".This file contain some text

Given below readfile() function is used to read the "demo.txt" file

Output : Hello ! welcome to Web Designing House