smarty变量调节器--count_characters[字符计数]

计算变量里的字符数。

参数位置类型是否必须默认描述
1 boolean No false 确定是否计算空格字符。

Example 5-4. count_characters

<?php
$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
?>

Where template is:
{$articleTitle}
{$articleTitle|count_characters}
{$articleTitle|count_characters:true}

Will output:

Cold Wave Linked to Temperatures.
29
33 

posted @ 2012-03-08 13:31  haiwei.sun  阅读(145)  评论(0编辑  收藏  举报
返回顶部