?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
Smarty - the compiling PHP template engine | ||
---|---|---|
Prev 來源:PHP中文社區(qū) | Chapter 5. Variable Modifiers[變量調(diào)節(jié)器] | Next |
Parameter Position參數(shù)位置 | Type參數(shù)類型 | Required必需 | Default默認(rèn) | Description描述 |
---|---|---|---|---|
1 | integer | No | 80 | This determines how many characters to truncate to. 截取字符的數(shù)量 |
2 | string | No | ... | This is the text to append if truncation occurs. 截取后追加在截取詞后面的字符串 |
3 | boolean | No | false | This determines whether or not to truncate at a word boundary (false), or at
the exact character (true). 是截取到詞的邊界(假)還是精確到字符(真) |
This truncates a variable to a character length, default is 80.
As an optional second parameter, you can specify a string of text to display
at the end if the variable was truncated. The characters in the string are
included with the original truncation length.
By default, truncate will attempt to cut off at a word boundary.
If you want to cut off at the exact character length, pass the optional third
parameter of true.
從字符串開始處截取某長(zhǎng)度的字符.默認(rèn)是80個(gè).
你也可以指定第二個(gè)參數(shù)作為追加在截取字符串后面的文本字串.該追加字串被計(jì)算在截取長(zhǎng)度中。
默認(rèn)情況下,smarty會(huì)截取到一個(gè)詞的末尾。
如果你想要精確的截取多少個(gè)字符,把第三個(gè)參數(shù)改為"true"
Example 5-21. truncate
|
Prev 來源:PHP中文社區(qū) | Home | Next |
strip_tags[去除Html標(biāo)簽] | Up | upper[大寫] |