$fileType = mb_detect_encoding($strData , array('UTF-8','GBK','LATIN1','BIG5','CP936')) ;//可以在此处添加编码格式$str = "";if( $fileType != 'UTF-8'){ $str = mb_convert_encoding($strData ,'UTF-8' , $fileType);}