1. 首页
  2. 数据库
  3. 其它
  4. PHP版 汉字转码的实现详解

PHP版 汉字转码的实现详解

上传者: 2020-12-31 10:36:59上传 PDF文件 30.36KB 热度 7次
如下所示:复制代码 代码如下:<?phpfunction unicode_encode($str, $encoding=’GBK’, $prefix=’&#’, $postfix=’;’){ $str = iconv($encoding, ‘UCS-2’, $str); $arrstr = str_split($str, 2); $unistr = ”; for($i=0, $len=count($arrstr); $i<$len; $i++) { $dec = hexdec(bin2hex($arrstr[$i])); $unistr .= $prefix.$dec.$pos
下载地址
用户评论