Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从中文字符串中获取一些字符。但是最后总是出现一个垃圾字符。
如何从中文字符串中获取一些字符?
假设您使用的是 PHP:
当使用非 ascii 字符时,你应该使用多字节函数,在这种情况下是函数mb_substr。请记住设置内部编码以通过mb_internal_encoding函数使用。
mb_substr
mb_internal_encoding