Home  >  Article  >  Backend Development  >  PHP怎么输出换行符

PHP怎么输出换行符

WBOY
WBOYOriginal
2016-06-13 13:31:342433browse

PHP如何输出换行符?
PHP输出html源码,因为查看源码时,有许多都在一起没有换行!


想让源码换行!

想问一下如何输出换行符?

服务器为win!也问一下linux下如何输出

------解决方案--------------------
windows \r\n \r为回车符
linux \n
------解决方案--------------------

探讨
windows \r\n \r为回车符
linux \n

------解决方案--------------------
echo "
";
echo "

";
echo "\n";

------解决方案--------------------
查看html源码.用
这个也不错.

------解决方案--------------------
输出HTML代码时换行用echo "\n" 

在页面显示时换行用echo "
"
------解决方案--------------------
\n就可以了

Windows下是\r\n
Linux/UNIX下是\n
Mac下是\r
------解决方案--------------------
PHP code
echo "\n"
<br><font color="#e78608">------解决方案--------------------</font><br>将你要输出的数据处理后再输出。<br><br>function strip_textarea($string)<br>{<br>   return nl2br(str_replace(' ', ' ', htmlspecialchars($string, ENT_QUOTES)));<br>}<br><br>或者是和nl2br相反的函数,你可以查查手册 <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn