Description of intercepting string functions in the Thinkphp template. There are many functions that intercept strings in php, and php functions can also be used directly in thinkphp. This article will give you a brief introduction to the specific usage of intercept strings in the thinkPHP template, many functions are expected to intercept strings in php, while php functions can also be used directly in thinkphp. This article will give you a brief introduction to the specific usage of intercept strings in the thinkPHP template, hope to help you.
The following form can be used for English characters:
The code is as follows:
{$ Vo. title | substr = 0, 5}
If yesThe Chinese character thinkphp provides msubstrThe usage is as follows:
The code is as follows:
Function msubstr ($ str, $ start = 0, $ length, $ charset = "UTF-8", $ suffix = true) // use the following
{$ Vo. title | msubstr = 5, 'utf-8', true}
The msubstr function is described as follows:
Msubstr ($ str, $ start = 0, $ length, $ charset = "UTF-8", $ suffix = true)
$ Str: string to be truncated
$ Start = 0: start position, starting from 0 by default
$ Length: truncation length
$ Charset = "UTF-8": Character encoding, default UTF-8
$ Suffix = true: whether the ellipsis is displayed after the truncated characters. the default value is true, and false indicates that the ellipsis is not displayed.
...