好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

php获取字符串uft-8编码 - php函数

php获取字符串uft-8编码

//方法一,代码如下:     echo  preg_replace( '#[x{4e00}-x{9fa5}]#ue' , 'chinese_unicode("\0")' , "您好,中国" ); //保证"您好,中国"是utf-8。   function  chinese_unicode( $c ) {           return   "u" . dechex (((ord( $c [0]) & 0x1f) << 12) + (ord( $c [1]) & 0x3f << 6) + (ord( $c [2]) & 0x3f));    }    //方法二,代码如下:     foreach (unpack( //开源代码phpfensi测试数据   'n*' ,  mb_convert_encoding( '你好' ,  'unicode' ,  'gbk' )  )  as   $i ) {  echo   'u' , dechex ( $i );    } 

查看更多关于php获取字符串uft-8编码 - php函数的详细内容...

  阅读:43次