<span style="font-family: Arial, Helvetica, sans-serif;">$encode = mb_detect_encoding($string, array("ASCII",'UTF-8′)); </span>
php
第一个参数是你要判断的string字符串
第二个字数可以不填,是一个编码格式数组
返回的结果为string格式 例如 $encode="utf-8";
http://php.net/manual/zh/function.mb-detect-encoding.php
这是php官方文档对mb_detect_encoding的解释