wordwrap
行宽约束
Parameter Position | Type | Required | Default | Description |
---|---|---|---|---|
1 | integer | No | 80 | This determines how many columns to wrap to. 指定段落(句子)的宽度 |
2 | string | No | \n | This is the string used to wrap words with. 使用什么字符约束 |
3 | boolean | No | false | This determines whether or not to wrap at a word boundary (false), or at the
exact character (true). 是约束到词的边界(假)还是精确到字符(真) |
This wraps a string to a column width, default is 80.
As an optional second parameter, you can specify a string of text to wrap
the text to the next line (default is carriage return \n).
By default, wordwrap will attempt to wrap at a word boundary. If you want
to cut off at the exact character length, pass the optional third parameter
of true.
可以指定段落的宽度(也就是多少个字符一行,超过这个字符数换行).默认80.
第二个参数可选,可以指定在约束点使用什么字符(默认是换行符\n).
默认情况下smarty将截取到词尾,如果想精确到设定长度的字符,请将第三个参数设为ture
Example 5-23. wordwrap
|