count_characters

PHP Smarty

Smarty - the compiling PHP template engine
Prev 来源:PHP中文社区 Chapter 5. Variable Modifiers Next

count_characters[字符计数]

Parameter Position Type Required Default Description
1 boolean No false This determines whether or not to include whitespace characters in the count.
决定是否计算空格字符。
index.php:

$smarty = new Smarty;
$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
$smarty->display('index.tpl');

index.tpl:

{$articleTitle}
{$articleTitle|count_characters}
{$articleTitle|count_characters:true}

OUTPUT输出:

Cold Wave Linked to Temperatures.
29
33

Prev 来源:PHP中文社区 Home Next
Variable Modifiers Up cat