首页 > 运营 > CMS建站 > 正文

织梦之Unicode转utf8

2020-02-06 17:46:43
字体:
来源:转载
供稿:网友
//unicode转utf8
function u2utf8($c) {
 for ($i = 0;$i < count($c);$i++)
  $str = "";
 if ($c < 0x80) {
  $str .= $c;
 } else if ($c < 0x800) {
  $str .= (0xc0 | $c >> 6);
  $str .= (0x80 | $c & 0x3f);
 } else if ($c < 0x10000) {
  $str .= (0xe0 | $c >> 12);
  $str .= (0x80 | $c >> 6 & 0x3f);
  $str .= (0x80 | $c & 0x3f);
 } else if ($c < 0x200000) {
  $str .= (0xf0 | $c >> 18);
  $str .= (0x80 | $c >> 12 & 0x3f);
  $str .= (0x80 | $c >> 6 & 0x3f);
  $str .= (0x80 | $c & 0x3f);
 }
 return $str;
}

最大的网站源码资源下载站,

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表