是的,PHP的mb_detect_encoding函數(shù)可以用來檢測字符串的編碼格式,包括UTF-8編碼。當檢測到UTF-8編碼時,函數(shù)會返回"UTF-8"。示例代碼如下:
$text = "你好,世界!"; $encoding = mb_detect_encoding($text, "UTF-8"); if($encoding == "UTF-8"){ echo "字符串編碼為UTF-8"; }else{ echo "字符串編碼不是UTF-8"; }
億速云公眾號
手機網(wǎng)站二維碼
Copyright ? Yisu Cloud Ltd. All Rights Reserved. 2018 版權(quán)所有
廣州億速云計算有限公司粵ICP備17096448號-1 粵公網(wǎng)安備 44010402001142號增值電信業(yè)務經(jīng)營許可證編號:B1-20181529