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.
无论如何使用preg_match或strpos来识别字符串中是否存在双字节字符?
我正在接收包含中文文本和英文混合的 XML 文件,并且想跳过任何包含中文文本的文件。XML 是 utf-8 编码的。
你可以这样做:
if (mb_strlen($string, 'UTF-8') != strlen($string)) { // string contains multibyte characters }