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

PHPServer Side ProgrammingProgramming

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.

Published on 09-Apr-2020 14:37:35