First of all
1. Make sure you have the file php_mbstring.dll under Windows/system32. If not, copy it from your Php installation directory extensions into Windows/system32.
2. Find php.ini in the windows directory, open it for editing, search for mbstring.dll, find
;extension=php_mbstring.dll and remove the ";" sign in front, so that the mb_substr function can take effect
The mb_strcut function can also intercept the length of the string. Let’s see the difference in the following example:
Copy the code The code is as follows:
$str = 'This way my string will not be garbled^_^';
echo "mb_substr:" . mb_substr($str, 0, 7, 'utf-8');
//Result: In this way, my words
echo "
";
echo "mb_strcut:" . mb_strcut($ str, 0, 6, 'utf-8');
//Result: like this
?>
As can be seen from the above example, mb_substr is Words are used to split characters, while mb_strcut is used to split characters by bytes, but neither will produce half a character.
http://www.bkjia.com/PHPjc/318741.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318741.htmlTechArticleFirst 1. Make sure you have the file php_mbstring.dll under Windows/system32. If not, go to your Php installation directory Copy extensions into Windows/system32. 2. Find php.i...
in the windows directory