nl2br[replace newline character with <br />]

nl2br[Line breaks replaced with <br /> ]

##test.php:$smarty = new Smarty;
$smarty->assign('articleTitle', "Sun or rain expected\ntoday, dark tonight");
$smarty->display('test.html');


test.html:{$articleTitle|nl2br}


Output:Sun or rain expected<br />today, dark tonight

Continuing Learning
||
<?php echo "nl2br[换行符替换成<br /> ]";
submitReset Code