# PHP: How do I display the contents of a textfile on my page?

PHPServer Side ProgrammingProgramming

#### PHP Online Training

45 Lectures 9 hours

#### PHP in Telugu

43 Lectures 5.5 hours

#### Redis and PHP

22 Lectures 40 mins

The file_get_contents function takes the name of the php file and reads the contents of the text file and displays it on the console. get the contents, and echo it out.

<?php
echo file_get_contents( "filename.php" );
?>

The contents of filename.php would be the output.

In the above code, the function ‘file_get_contents’ is called by passing the php file name. The output will be the contents present in the php file.

Updated on 09-Apr-2020 11:08:04