count_characters
计算变量内容里有多少个字符。
参数顺序 | 类型 | 必选参数 | 默认值 | 说明 |
---|---|---|---|---|
1 | boolean | No | FALSE |
计算总数时是否包括空格字符。 |
- <?php
- $smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
- ?>
模板:
- {$articleTitle}
- {$articleTitle|count_characters}
- {$articleTitle|count_characters:true}
输出:
- Cold Wave Linked to Temperatures.
- 29
- 33
参见 count_words
, count_sentences
和 count_paragraphs
.
原文: https://www.smarty.net/docs/zh_CN/language.modifier.count.characters.tpl