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

前端 未结 8 733
囚心锁ツ
囚心锁ツ 2020-12-16 09:37

I have a .txt file on my web server (locally) and wish to display the contents within a page (stored on the same server) via PHP echo.

The .txt file contains a numbe

相关标签:
8条回答
  • 2020-12-16 10:24

    Use PHP's fopen

    0 讨论(0)
  • 2020-12-16 10:25

    Here, try this (assuming it's a small file!):

    <?php
    echo file_get_contents( "filename.php" ); // get the contents, and echo it out.
    ?>
    

    Documentation is here.

    0 讨论(0)
提交回复
热议问题