Output text file with line breaks in PHP

前端 未结 9 1060
一个人的身影
一个人的身影 2020-11-28 14:11

I\'m trying to open a text file and output its contents with the code below. The text file includes line breaks but when I echo the file its unformatted. How do I fix this?<

9条回答
  •  孤城傲影
    2020-11-28 14:58

    If you just want to show the output of the file within the HTML code formatted the same way it is in the text file you can wrap your echo statement with a pair of pre tags:

    echo "
    " . $pageText . "
    ;

    Some of the other answers look promising depending on what you are trying todo.

提交回复
热议问题