php echo中的\ n或\ n不打印 [英] \n or \n in php echo not print
本文介绍了php echo中的\ n或\ n不打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Possible Duplicate:
Print newline in PHP in single quotes
Difference between single quote and double quote string in php
$unit1 = 'paragrahp1';
$unit2 = 'paragrahp2';
echo '<p>' . $unit1 . '</p>\n';
echo '<p>' . $unit2 . '</p>';
正在显示(在查看源上):
This is displaying (on view source):
<p>paragraph1</p>\n<p>paragraph2</p>
但不是我所期望的,不是打印新行,那会是什么?
but isnt what I’m expecting, not printing the new line, what can be?
推荐答案
在双引号("
)
这有效(换行符):
"\n"
这不会导致换行符:
'\n'
这篇关于php echo中的\ n或\ n不打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文