Get Smarty

Donate

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap glasses from Cheapglasses123.com and save up to 80%.

Where to buy prescription glasses? EyewearCanada.com is your best choice!

Advertisement

count_characters

计算变量内容里有多少个字符。

参数顺序 类型 必选参数 默认值 说明
1 boolean No FALSE 计算总数时是否包括空格字符。

Example 5.4. count_characters


<?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_sentencescount_paragraphs.

Comments
No comments for this page.

Advertisement