<?
echo "<p>__________________________<p>";
$string="242432反对感是456,,犯得上广泛大使馆地方7890abc";
$mb_strlen=mb_strlen($string);
$len=20;
echo $string."<p>";
echo "总长为:".($mb_strlen+1)."<p>";
echo "截取数:".$len."<p>";
for($i=1;$i<=$mb_strlen+1;$i++){
if($i>$len){
echo $i."<b> →</b> ".mb_substr($string,$i)."…<br>";
continue;
}
echo $i."<b> →</b> ".mb_substr($string,$i)."<br>";
}
?>
参看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!