mb_check_encoding
Vérifiez si la chaîne est valide dans le codage spécifié
Nom de la fonction: mb_check_encoding ()
Version applicable: PHP 4> = 4.0.6, PHP 5, PHP 7
Fonction Description: MB_CHECK_ENCODING () La fonction est utilisée pour vérifier si une chaîne est le codage de caractères spécifié.
Utilisation: bool mb_check_encoding (String $ var [, chaîne $ coding = mb_internal_encoding ()])
paramètre:
Valeur de retour:
Exemple:
// 检查字符串是否是UTF-8 编码$str = "Hello, 世界!"; if (mb_check_encoding($str, "UTF-8")) { echo "字符串是UTF-8 编码"; } else { echo "字符串不是UTF-8 编码"; }
Sortir:
字符串是UTF-8 编码
Notes: