php截取字符串

php截取字符串的过程中,如果碰到中文字符,substr会返回空值或者乱码,幸好还有一个函数处理中文比较有效

<?php
echo substr("qbcd",1);//bcd 
echo mb_substr("php是世界上最好的web编程语言",1,3,"UTF-8");//对中文有效
?>
发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>