我有一个String变量,我需要将它打印成两行。这是我的字符串。
$send = "Thank you for registering. For more details contact us";
我需要像这样打印这个字符串
Thank you for registering.
For more details contact us
我试过这个
$send = "Thank you for registering.<br/> For more details contact us";
但它打印了这个:
Thank you for registering.<br/> For more details contact us
如何根据需要打印?
谢谢!
答案 0 :(得分:2)
$send = "Thank you for registering.<br/> For more details contact us";
echo $send;
如果您正在使用echo,这不应该成为一个问题。如果这不起作用,请尝试:
$send = "Thank you for registering.\n For more details contact us";
希望它有所帮助。
答案 1 :(得分:2)
<?php $send = "Thank you for registering.\n For more details contact us"; ?>
如果您想在textarea或电子邮件中打印,可以使用
<textarea>
<?php echo $send; ?>
</textarea>
如果您想以HTML格式打印,请尝试
<?php echo nl2br($send); ?>
答案 2 :(得分:1)
如果您想在文本区域中发短信,可以试试这个
$send = "Thank you for registering. For more details contact us";
<textarea>
<?php echo $send; ?>
</textarea>
答案 3 :(得分:0)
在HTML
$send = "Thank you for registering.<br/> For more details contact us";
对于纯文本文件
$send = "Thank you for registering.\n For more details contact us";
答案 4 :(得分:0)
尝试以下代码。
$send = "Thank you for registering with Playit. \n If you have any questions please contact ramesh@emagine.lk.";