nl2br[換行符替換成<br /> ]
nl2br[換行符替換成
> ]
test.php:
$smarty = new Smarty;
$smarty->assign('articleTitle', "今天預(yù)計晴天或下雨,今晚黑暗");
$smarty->display(' test.html');
test.html:
{$articleTitle|nl2br}
輸出:
預(yù)計有陽光或下雨
今天,今晚黑暗
nl2br[換行符替換成
> ]
test.php:
$smarty = new Smarty;
$smarty->assign('articleTitle', "今天預(yù)計晴天或下雨,今晚黑暗");
$smarty->display(' test.html');
test.html:
{$articleTitle|nl2br}
輸出:
預(yù)計有陽光或下雨
今天,今晚黑暗
看過本課程的同學(xué)也在學(xué)