1. First, make sure you have the file php_mbstring.dll in 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 strings. Length, let’s see the difference in detail in the following example:
<?php $str = '这样一来我的字符串就不会有乱码^_^'; echo "mb_substr:" . mb_substr($str, 0, 7, 'utf-8'); //结果:这样一来我的字 echo " "; echo "mb_strcut:" . mb_strcut($str, 0, 6, 'utf-8'); //结果:这样 ?>