我有一个php CLI脚本,不能让输出在新行上换行。我知道
echo 'this is my text\r\n';
echo 'next line';
这给了我们
this is my text\r\nnext line
关于如何在不同的行上获得输出,有什么想法吗?
发布于 2011-07-25 23:56:26
使用双引号"
。
echo "next line\n";
此外,您还可以使用系统相关常量PHP_EOL
echo "this is my text" . PHP_EOL;
发布于 2011-07-25 23:55:57
请使用双引号。"
。
发布于 2011-07-25 23:55:58
转义序列只有在双引号内,而不是单引号内时才会被解析。
https://stackoverflow.com/questions/6818875
复制相似问题