Later, I found the is_utf8 function in the manual. In this way, combined with the iconv function, my problem was solved. This function is posted below:
Copy code The code is as follows:
function is_utf8($string) {
return preg_match('%^(?:
[x09x0Ax0Dx20-x7E] # ASCII
| [xC2- xDF][x80-xBF] # non-overlong 2-byte
|
| xED[x80-x9F][x80-xBF] # excluding surrogates
| 3} # planes 4-15
| For research, it is recommended to read the "Multibyte String Functions" section of the PHP manual.
The above introduces the implementation code of converse one star PHP mb_convert_encoding to obtain the string encoding type, including the content of converse one star. I hope it will be helpful to friends who are interested in PHP tutorials.