count_sentences[計(jì)算句數(shù)]
count_sentences[計(jì)算句數(shù)]
test.php:
$smarty = new Smarty;
$smarty->assign('articleTitle', '兩艘蘇聯(lián)船相撞 - 其中一艘死亡。憤怒的牛用斧頭傷害農(nóng)夫。');
$smarty->display('test.html');
test.html:
{$articleTitle}
{$articleTitle|count_sentences}
輸出:
兩艘蘇聯(lián)船只相撞 - 其中一艘死亡。憤怒的牛用斧頭傷害農(nóng)民。
2