Function: mb_substr( $str, $start, $length, $encoding )
$str, the string that needs to be truncated
$start, the starting point of truncation
$length, the length (note, this Different from mb_strimwidth, 1 represents a Chinese character)
$encoding, encoding, I set it to utf-8
Example: Truncate the article title and control it to 15 characters
Copy code The code is as follows:
http://www.bkjia.com/PHPjc/326820.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326820.htmlTechArticleFunction: mb_substr( $str, $start, $length, $encoding ) $str, the string that needs to be truncated $start, truncation start point $length, length (note, this is different from mb_strimwidth, 1 represents one...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn