?
本文檔使用 PHP中文網手冊 發(fā)布
Smarty - the compiling PHP template engine | ||
---|---|---|
Prev 來源:PHP中文社區(qū) | Chapter 5. Variable Modifiers[變量調節(jié)器] | Next |
Parameter Position參數(shù)位置 | Type參數(shù)類型 | Required必需 | Default默認 | 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.
從字符串開始處截取某長度的字符.默認是80個.
你也可以指定第二個參數(shù)作為追加在截取字符串后面的文本字串.該追加字串被計算在截取長度中。
默認情況下,smarty會截取到一個詞的末尾。
如果你想要精確的截取多少個字符,把第三個參數(shù)改為"true"
Example 5-21. truncate
|
Prev 來源:PHP中文社區(qū) | Home | Next |
strip_tags[去除Html標簽] | Up | upper[大寫] |