php函数:判断字符编码的简单方法
- <?php
- function chkbm($string){
- $bm = array(ASCII, GBK, UTF-8);
- foreach($bm as $c){
- if( $string === iconv(UTF-8, $c, iconv($c, UTF-8, $string))){//转换编码后是不是相等
- return $c;
- }
- }
- return null;
- }
- ?>
/phprm/24802.htmlwww.phpzy.comtrue/phprm/24802.htmlTechArticlephp函数:判断字符编码的简单方法 ?php function chkbm($string){ $bm = array(ASCII, GBK, UTF-8); foreach($bm as $c){ if( $string === iconv(UTF-8, $c, iconv($c, UTF-8, $string))){//转换编码后是不是相等 return $c; } } ret...
PHP之友评论