PHP头条
热点:

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


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

www.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之友评论

今天推荐