count_characters[字符计数]

count_characters(计算变量里的字符数)

test.php:
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
$smarty->display('test.html');

test.html:
{$articleTitle}
{$articleTitle|count_characters}
{$articleTitle|count_characters:true} //空格也计入数

输出:
Cold Wave Linked to Temperatures.
29
33

继续学习
||
<?php echo "count_characters(计算变量里的字符数)";
提交重置代码