It is the best method to use the multi-byte processing function provided by php to process Chinese characters. Echo __________________________; $ string242432 the objection is 456, which constitutes a widely used Embassy in 7890abc; $ mb_strlenmb_strlen ($ string); $ len20; echo $ string .; the total echo length is :. ($ m echo"
__________________________
";
$ String = "242432 objection: 456, which is equivalent to 7890abc in a wide range of embassy places ";
$ Mb_strlen = mb_strlen ($ string );
$ Len = 20;
Echo $ string ."
";
Echo "Total length:". ($ mb_strlen + 1 )."
";
Echo "number of interceptions:". $ 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 )."
";
}
?>
See the Multi-Byte String Functions in PHP,
(1) use -- enable-mbstring = cn during compilation
(2) modify/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 objection is 456, which makes extensive embassy place 7890abc; $ mb_strlen = mb_strlen ($ string); $ len = 20; echo $ string .; the total echo length is :. ($ m...