count_words[计算词数]

优质
小牛编辑
134浏览
2023-12-01

This is used to count the number of words in a variable.
计算变量里的词数 。

Example 5-7. count_words

index.php:
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
$smarty->display('index.tpl');
index.tpl:
{$articleTitle}
{$articleTitle|count_words}
OUTPUT:
Dealers Will Hear Car Talk at Noon.
7