首页 >后端开发 >php教程 >php函数:判断字符编码的简单方法_PHP教程

php函数:判断字符编码的简单方法_PHP教程

WBOY
WBOY原创
2016-07-13 17:40:551061浏览

  1. function chkbm($string){
  2.     $bm = array(ASCII, GBK, UTF-8);
  3.     foreach($bm as $c){
  4.         if( $string === iconv(UTF-8, $c, iconv($c, UTF-8, $string))){//转换编码后是不是相等
  5.             return $c;
  6.         }
  7.     }
  8.     return null;
  9. }
  10. ?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486172.htmlTechArticle?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))){//转换编码后是不是相等 retu...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn