读取文本文件会截断PHP中的行输出:
文本文件:
NEXT_GEN_TO="Project Bribara<project-automation@bribara.com>"
代码:
$lines = file('Text-file');
foreach ($lines as $line) {
echo "$line</br>";
}
期望值:
NEXT_GEN_TO="Project Bribara<project-automation@bribara.com>"
实际:
NEXT_GEN_TO="Project Bribara"
从文件中读取行后,如何打印预期结果?
发布于 2017-09-02 02:05:12
试着像这样输出...
echo htmlentities($line) . "</br>";
发布于 2017-09-02 02:03:35
浏览器将<project-automation@bribara.com>
视为html标记。如果你在浏览器中使用"View Source“查看页面输出的html源代码,它们都会出现在那里。
在输出之前,使用其中一个php函数将html转换为非html文本,比如在文本上使用htmlentities()。
https://stackoverflow.com/questions/46005744
复制相似问题