Introduction to intercepting string functions in the Thinkphp template _ PHP Tutorial

Source: Internet
Author: User
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.

...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.