Mb_strimwidth
(PHP 4 >= 4.0.6, PHP 5)
Mb_strimwidth-gets the string truncated by the specified width
Description
String Mb_strimwidth (string $str, int $start, int $width [, String $trimmarker [, String $encoding]])
Press width to truncate the string str.
Parameters
Str
The string to truncate.
Start
The offset from the start position. The Intercept string that starts with the number of characters. (the default is 0 characters)
Width
The width of the desired trim.
Trimmarker
When a string is truncated, this string is added to the end of the truncated section.
Encoding
The encoding parameter is a character encoding. If omitted, the internal character encoding is used.
return value
A truncated string. If Trimmarker is set, the Trimmarker is also appended to the returned value.
Example
Example #1 mb_strimwidth () example
<?php
Echo mb_strimwidth ("Hello World", 0, 10, "...");
Output Hello W ...
?>
The solution WordPress uses Mb_strimwidth function to appear garbled!
1, open the Apache Server mb_string extension Service.
2. String Mb_strimwidth (string $str, int $start, int $width [, String $trimmarker [, String $encoding]]
Use the encoding parameter to set the character encoding.
Example: <?php
Echo mb_strimwidth ("ios100-Knowledge Base", 0, "...", [backcolor= Transparent] "utf-8");
?>
Reprint please indicate the source: http://www.ios100.net/open/wordpress/49.html