/** * 检查字符串编码 * @param unknown $keytitle * @return string|unknown */ function strencd($keytitle,$code='UTF-8'){ $encode = mb_detect_encoding($keytitle, array('ASCII','UTF-8','GB2312','GBK','BIG5')); if ($encode != $code){ return iconv($encode,$code,$keytitle); } return $keytitle; }
One thought on “php字符串检查与编码更改”
Comments are closed.
呵呵。我是.NET之神