Home > Backend Development > PHP Tutorial > 怎样截取中文字符串?

怎样截取中文字符串?

WBOY
Release: 2016-06-23 13:33:43
Original
906 people have browsed it

0xa0判定没有效果,一个汉字是两个字符吗?

ord单个字符有值,chr却无法将值组合输出为汉字。

截取到的整段文字符串输出显示为乱码,单个字符截取输出的全是空白符。

中文截取要怎么弄???


回复讨论(解决方案)

iconv_substr
mb_substr
注意都要指明字符集

看下mb_string扩展

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template