【发布时间】:2019-10-29 12:17:04
【问题描述】:
我有一个平面文件 database-001.txt 文件,其中条目。我的 txt 文件如下所示:
Bill
message Bill goes here
1571436403
==
John
message John goes here
1571436126
==
Earl
message earl goes here
1571436051
==
为了读取 .txt 文件,我使用以下代码:
$flatfile = file_get_contents('database-001.txt');
echo $flatfile;
?>
但是像这样使用它,它会生成这个:
Bill message Bill goes here 1571436403==Johnmessage John goes here1571436126==Earlmessage earl goeshere 1571436051==
我如何才能像在 .txt 文件中一样读取带有换行符和白线的内容?
【问题讨论】:
-
您是在浏览器中查看结果吗?
-
是的,我在浏览器中查看结果
-
比在
<pre>标签中显示。 -
@kaczmen。这是有道理的。谢谢
标签: php file-get-contents