__________________________
";
$string="242432反对感是456,,犯得上广泛大使馆地方7890abc";
$mb_strlen=mb_strlen($string);
$len=20;
echo $string."
";
echo "总长为:".($mb_strlen+1)."
";
echo "截取数:".$len."
";
for($i=1;$i<=$mb_strlen+1;$i++){
if($i>$len){
echo $i." → ".mb_substr($string,$i)."…
";
continue;
}
echo $i." → ".mb_substr($string,$i)."
";
}
?>
参看PHP的Multi-Byte String Functions,
(1)编译时使用--enable-mbstring=cn
(2)修改/usr/local/lib/php.inc
default_charset = "zh-cn"
mbstring.language = zh-cn
mbstring.internal_encoding =zh-cn
Everthing I do, I do it for you!
My linux!