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

前端 未结 8 780
囚心锁ツ
囚心锁ツ 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条回答
  •  旧时难觅i
    2020-12-16 10:07

    if you just want to show the file itself:

    header('Content-Type: text/plain');
    header('Content-Disposition: inline; filename="filename.txt"');
    readfile(path);
    

提交回复
热议问题