Fixed content of dedecms interception and mysql interception field content

Source: Internet
Author: User
The dedecms screenshot can be directly written in the template as follows: [field: title? Functioncn_substr (@ me, 16)] indicates the specific usage of titlecn_substr: function: Specifies the length of the string to be intercepted by the string $ str, single-byte truncation mode. A Chinese Character occupies 2 bytes $ s

The dedecms screenshot can be directly written in the template as follows: [field: title? Function = "cn_substr (@ me,'', 16) "/] indicates the specific use of the title cn_substr: function: intercept Chinese string parameters: $ str = string to be intercepted $ slen = length to be intercepted. in single-byte truncation mode, a Chinese character occupies 2 bytes $ s

Dedecms interceptions can be directly written in the template.

As follows:

[Field: title? Function = "cn_substr (@ me,'', 16) "/]

Indicates the specific usage of intercepting title cn_substr:

Function:Truncate a Chinese String

Parameters:

$ Str ="String to be intercepted

$ Slen ="The length to be intercepted. It is a single-byte truncation mode. A Chinese Character occupies 2 bytes.

$ Startdd = 0Mark the start position of the truncation. The default value is 0 and starts from scratch.

Return Value:

Returns the truncated string. An error returns a null string.

Mysql Field Truncation update statement

UPDATE 'kdu _ archives' SET 'title' = substring ('title', 10)

The function is to update all content of the title and retain the content by length.

These interceptions may be very useful when collecting large volumes of content ~

Original article address: fixed content of dedecms interception and mysql interception fields. Thanks to the original author for sharing.

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.