时间:2021-07-01 10:21:17 帮助过:17人阅读
__________________________
";
$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!
http://www.bkjia.com/PHPjc/445600.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445600.htmlTechArticleecho __________________________ ; $string=242432反对感是456,,犯得上广泛大使馆地方7890abc; $mb_strlen=mb_strlen($string); $len=20; echo $string. ; echo 总长为:.($m...