💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
<table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><th colspan="3" align="center">Smarty - the compiling PHP template engine</th></tr><tr><td width="25%" align="left" valign="bottom"><a href="language.modifier.cat.html" accesskey="P">Prev</a></td><td width="50%" align="center" valign="bottom">Chapter 5. Variable Modifiers[变量调节器]</td><td width="25%" align="right" valign="bottom"><a href="language.modifier.count.paragraphs.html" accesskey="N">Next</a></td></tr></table> # count_characters[字符计数] This is used to count the number of characters in a variable. 计算变量里的字符数。 | Parameter Position | Type | Required | Default | Description | |-----|-----|-----|-----|-----| | 1 | boolean | No | false | This determines whether or not to include whitespace characters in the count. | | 参数位置 | 类型 | 是否必须 | 默认 | 描述 | |-----|-----|-----|-----|-----| | 1 | boolean | No | false | 确定是否计算空格字符。 | <table width="100%" border="0" cellpadding="0" cellspacing="0" class="EXAMPLE"><tr><td><div class="EXAMPLE"><a name="AEN254" id="AEN254"/><b>Example 5-4. count_characters</b><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td> <p>&lt;?php<br/> $smarty-&gt;assign('articleTitle', 'Cold Wave Linked to Temperatures.');<br/> ?&gt;<br/><br/> Where template is:<br/> {$articleTitle}<br/> {$articleTitle|count_characters}<br/> {$articleTitle|count_characters:true}<br/><br/> Will output:</p> <p>Cold Wave Linked to Temperatures.<br/> 29<br/> 33 </p> </td></tr></table><p>参见<a href="language.modifier.count.words.html">count_words</a>、<a href="language.modifier.count.sentences.html">count_sentences</a>和<a href="language.modifier.count.paragraphs.html">count_paragraphs</a>.</p></div></td></tr></table> <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="language.modifier.cat.html" accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="language.modifier.count.paragraphs.html" accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">cat<br/> 连接字符串</td><td width="34%" align="center" valign="top"><a href="language.modifiers.html" accesskey="U">Up</a></td><td width="33%" align="right" valign="top">count_paragraphs<br/> 计算段数</td></tr></table>