如果需要在PHP中解码UTF8,是否有可能检查字符串?
You can use mb_detect_encoding
to check if the string is already encoded in UTF-8:
mb_detect_encoding($str, 'UTF-8', true)
This returns false if the string is not valid UTF-8.
您可以使用确定字符串是否使用UTF-8编码
mb_detect_encoding($str, 'UTF-8');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.