count_character...LOGIN

count_characters[character count]

count_characters(Count the number of characters in the variable)

##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} //Spaces are also counted


Output:Cold Wave Linked to Temperatures.
29
33

Next Section

<?php echo "count_characters(计算变量里的字符数)";
submitReset Code
ChapterCourseware