任何人都可以告诉我,为什么PHP_EOL不在我的Mac上工作?
码:
echo 'This is first line'.PHP_EOL.'This is second line';
Run Code Online (Sandbox Code Playgroud)
任何人都能帮我解决这个问题吗?
我只是猜测你在浏览器中查看结果,其中空格被折叠.PHP可能会输出:
This is first line
This is second line
Run Code Online (Sandbox Code Playgroud)
但浏览器呈现如下:
这是第一行这是第二行
要在HTML中插入显式换行符,请使用<br>标记.