🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
<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.modifiers.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.cat.html" accesskey="N">Next</a></td></tr></table> # capitalize[首字符大写] This is used to capitalize the first letter of all words in a variable. This is similar to the PHP ucwords() [http://php.net/ucwords] function. 将变量里的所有单词首字大写。它与php的[ucwords()](http://php.net/ucwords)函数类似。 | **Parameter Position** | **Type** | **Required** | **Default** | **Description** | |-----|-----|-----|-----|-----| | 1 | Boolean | No | FALSE | This determines whether or not words with digits will be uppercased | | **参数位置** | **类型** | **必需** | **默认** | **描述** | |-----|-----|-----|-----|-----| | 1 | Boolean | No | FALSE | 确定带数字的单词是否需要大写 | <table width="100%" border="0" cellpadding="0" cellspacing="0" class="EXAMPLE"><tr><td><div class="EXAMPLE"><a name="AEN252" id="AEN252"/><b>Example 5-2. capitalize<br/>例 5-2.首字大写</b><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="PROGRAMLISTING">&lt;?php$smarty-&gt;assign('articleTitle', 'next x-men film, x3, delayed.');?&gt; Where the template is:{$articleTitle}{$articleTitle|capitalize}{$articleTitle|capitalize:true} Will output:next x-men film, x3, delayed.Next X-Men Film, x3, Delayed.Next X-Men Film, X3, Delayed.</pre></td></tr></table><p>See also lower and upper<br/>参见<a href="language.modifier.lower.html">lower</a>和<a href="language.modifier.upper.html">upper</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.modifiers.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.cat.html" accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Variable Modifiers<br/> 变量调节器 </td><td width="34%" align="center" valign="top"><a href="smarty.for.designers.html" accesskey="U">Up</a></td><td width="33%" align="right" valign="top">cat<br/> 连接字符串</td></tr></table>