• 技术文章 >后端开发 >php教程

    php汉字转码 GBK->Unicode(UTF8)编码转换

    2016-07-25 08:53:53原创1219
    1. //php汉字转码 GBK->Unicode(UTF8)
    2. class qswhGBK{
    3. var $qswhData;
    4. function qswhGBK($filename="qswhGBK.php"){
    5. $this->qswhData=file($filename);
    6. }
    7. function gb2u($gb,$callback=""){
    8. /******(qiushuiwuhen 2002-8-15)******/
    9. $ret="";
    10. for($i=0;$i if(($p=ord(substr($gb,$i,1)))>127){
    11. $q=ord(substr($gb,++$i,1));
    12. $q=($q-($q>128?65:64))*4;
    13. $q=substr($this->qswhData[$p-128],$q,4);
    14. }
    15. else
    16. $q=dechex($p);
    17. if(empty($callback))
    18. $ret.=$q;
    19. else {
    20. $arr=array("htmlHex","htmlDec","escape","u2utf8");
    21. if(is_integer($callback)){
    22. if($callback>count($arr))die("Invalid Function");
    23. $ret.=$this->$arr[$callback-1]($q);
    24. }else
    25. $ret.=$callback($q);
    26. }
    27. }
    28. return $ret;
    29. }
    30. function htmlHex($str){
    31. return "&#x".$str.";";
    32. } // 程序员之家 bbs.it-home.org
    33. function htmlDec($str){
    34. return "&#".hexdec($str).";";
    35. }
    36. function escape($str){
    37. return hexdec($str)<256?chr(hexdec($str)):"%u".$str;
    38. }
    39. function u2utf8($str){
    40. /******(qiushuiwuhen 2002-8-15)******/
    41. $sp="!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~";
    42. $dec=hexdec($str);
    43. $bin=decbin($dec);
    44. $len=strlen($bin);
    45. $arr=array("c0","e0","f0");
    46. if($dec>0x7f){
    47. $ret="";
    48. for($i=$len,$j=-1;$i>=0;$i-=6,$j++){
    49. if($i>6)
    50. $ret="%".dechex(0x80+bindec(substr($bin,$i-6,6))).$ret;
    51. else
    52. $ret="%".dechex(hexdec($arr[$j])+bindec(substr($bin,0,6-$i))).$ret;
    53. }
    54. }else{
    55. if(strpos($sp,chr($dec)))
    56. $ret=chr($dec);
    57. else
    58. $ret="%".strtolower($str);
    59. }
    60. return $ret;
    61. }
    62. }
    复制代码

    调用例子:

    1. $words="中文Abc";

    2. function ex($str){return "[".$str."]";}

    3. $qswh=new qswhGBK("qswhGBK.php");//如果文件名是qswhGBK.php,可省参数

    4. echo("

      不带参数:".$qswh->gb2u($words));<li>echo("/n调用内置函数htmlHex:".$qswh->gb2u($words,1));<li>echo("/n调用内置函数htmlDec:".$qswh->gb2u($words,2));<li>echo("/n调用内置函数escape:".$qswh->gb2u($words,3));<li>echo("/n调用内置函数u2utf8:".$qswh->gb2u($words,4));<li>echo("/n调用自定义函数:".$qswh->gb2u($words,ex));</p><li></ol></div><em onclick="copycode($('code_sd4'));">复制代码</em></div><p>效果: </p> 不带参数:4E2D6587416263 调用内置函数htmlHex:&#x4E2D;&#x6587;&#x41;&#x62;&#x63; 调用内置函数htmlDec:&#20013;&#25991;&#65;&#98;&#99; 调用内置函数escape:%u4E2D%u6587Abc 调用内置函数u2utf8:%e4%b8%ad%e6%96%87Abc 调用自定义函数:[4E2D][6587][41][62][63]</td></tr></table> </div> <div id="comment_46856" class="cm"> </div> <div id="post_rate_div_46856"></div> <br><br><blockquote><p><span style="color: rgb(255, 0, 0);">php入门到就业线上直播课:</span><a href="//m.sbmmt.com/jump/go.php?url=https%3A%2F%2Fm.sbmmt.com%2Fk.html&location=mob-article-content-php" rel="nofollow" target="_blank">查看学习</a></p></blockquote><div class='bg-white layui-clear' style="margin:15px 0;"><span style="color:red;">声明:</span>本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。</div><div class="wwads-cn wwads-horizontal" data-id="164" style="max-width:640px"></div><blockquote><p><span style="color: rgb(255, 0, 0);">前端(VUE)零基础到就业课程:</span><a href="//m.sbmmt.com/jump/go.php?url=https%3A%2F%2Fm.sbmmt.com%2Fmap%2F2.html&mob-article-bottom" rel="nofollow" target="_blank">点击学习</a></p><p><a href="//m.sbmmt.com/jump/go.php?url=https%3A%2F%2Fm.sbmmt.com%2Fmap%2F2.html&mob-article-bottom" rel="nofollow" target="_blank">清晰的学习路线+老师随时辅导答疑</a></p></blockquote><blockquote><p><span style="color: rgb(255, 0, 0);">自己动手写 PHP MVC 框架:</span><a href="//m.sbmmt.com/jump/go.php?url=https%3A%2F%2Fm.sbmmt.com%2Fcourse%2F1467.html&mob-article-bottom" rel="nofollow" target="_blank">点击学习</a></p><p><a href="//m.sbmmt.com/jump/go.php?url=https%3A%2F%2Fm.sbmmt.com%2Fcourse%2F1467.html&mob-article-bottom" rel="nofollow" target="_blank">快速了解MVC架构、了解框架底层运行原理</a></p></blockquote><a href="//m.sbmmt.com/jump/go.php?url=https%3A%2F%2Fm.sbmmt.com%2Fmk.html&location=mob-article-zhibo" target="_blank"><img src="//m.sbmmt.com/img/upload/article/000/000/020/633501a29d313483.png" width="100%" /></a><div class='tags bg-white layui-clear pt-5'><span>专题推荐:</span><a href="//m.sbmmt.com/m/search?word=php汉字转码gbk-&amp;gt;unicodeutf8编码转换" target="_blank">php汉字转码 GBK-&amp;gt;Unicode(UTF8)编码转换</a></div><div><span style="display:inline-block; width: 100%; margin-top: 10px;"> 上一篇:<a style="color: #00AEEF;" href="//m.sbmmt.com/m/article/315476.html">php编码转换方法举例 </a></span><span style="display:inline-block; width: 100%"> 下一篇:<a style="color: #00AEEF;" href="//m.sbmmt.com/m/course/1467.html">自己动手写 PHP MVC 框架(40节精讲/巨细/新人进阶必看)</a></span></div></article><!--<div class="selectButton"><button type="button">点击阅读全文</button></div>--><!--<a href="javascript:;" onclick="location.href='https://m.xp.cn/'" rel="nofollow"><img src="//m.sbmmt.com/m/static/images/articlead.jpg" width="100%" alt="phpstudy集成环境下载"></a>--><!--<a href="//m.sbmmt.com/m/vip_mobile.html" rel="nofollow"><img src="//m.sbmmt.com/m/static/images/articlead1.gif" width="100%" alt="会员特权"></a>--></div><div class='course-list bg-white layui-clear'><h4>相关文章推荐</h4><a href="//m.sbmmt.com/jump/go.php?url=https%3A%2F%2Fm.sbmmt.com%2Fvip_mobile.html" style="color: red;" rel="nofollow" target="_blank" title='共22门课程,总价3725元,会员免费学' class='alist'>• ❤️‍🔥共22门课程,总价3725元,会员免费学</a><a href="//m.sbmmt.com/jump/go.php?url=https%3A%2F%2Fm.php.cn%2Farticle%2F496353.html" style="color: #FF6600;" rel="nofollow" target="_blank" title='接口自动化测试不想写代码?' class='alist'>• ❤️‍🔥接口自动化测试不想写代码?</a><a href='//m.sbmmt.com/m/article/499036.html' title="工具包分享:PHP实现滑块验证图片" class='alist'>• 工具包分享:PHP实现滑块验证图片</a><a href='//m.sbmmt.com/m/article/210206.html' title=" 请教QQ互联的代码是如何写的? " class='alist'>• 请教QQ互联的代码是如何写的? </a><a href='//m.sbmmt.com/m/article/223112.html' title=" 注册信息添加到数据库,该怎么处理 " class='alist'>• 注册信息添加到数据库,该怎么处理 </a><a href='//m.sbmmt.com/m/article/233573.html' title="PHP对XML操作2" class='alist'>• PHP对XML操作2</a><a href='//m.sbmmt.com/m/article/251273.html' title="麻烦帮我看看这个该怎么正则匹配" class='alist'>• 麻烦帮我看看这个该怎么正则匹配</a></div><div id="phpad" style="max-width:640px; height:auto; min-height: 10px;"><a href="//m.sbmmt.com/jump/go.php?url=https%3A%2F%2Fm.php.cn%2Fmap%2F2.html&location=mob-banner-vue" target="_blank"><img src="//m.sbmmt.com/m/static/images/sw/vue_xuexi.jpg" width="100%" /></a></div><div class='course-list bg-white layui-clear mt-10 mb-30'><ul ><h4>相关课程推荐</h4><li class='layui-clear' style="padding-left: 0px;"><a href="//m.sbmmt.com/m/course/386.html" class="course-arctic-img"><img src='//m.sbmmt.com/img/upload/course/000/000/001/5d1c6df423564706.jpg' height="100%"></a><div class='course-intro' style="margin-left: 0px;"><h2><a href="//m.sbmmt.com/m/course/386.html">独孤九贱(3)_JavaScript视频教程</a></h2><p class='course-intro-info'>javascript是运行在浏览器上的脚本语言,连续多年,被评为全球最受欢迎的编程语言。是前端开发必备三大法器中,最具杀伤力。如果前端开发是降龙十八掌,好么javascript就是第18掌:亢龙有悔。没有它,你的前端生涯是不完整的。《php.cn独孤九贱(3)-JavaScript视频教程》课程特色:php中文网原创幽默段子系列课程,以恶搞,段子为主题风格的php视频教程!轻松的教学风格,简短的教学模式,让同学们在不知不觉中,学会了javascript知识。</p><p><a href="//m.sbmmt.com/m/course/list/17.html"><span class='level'>JavaScript教程</span></a><span class='count'>139579次播放</span></p></div></li><hr><li class='layui-clear' style="padding-left: 0px;"><a href="//m.sbmmt.com/m/course/582.html" class="course-arctic-img"><img src='//m.sbmmt.com/img/upload/course/000/000/001/5d1c6e0d2b744633.jpg' height="100%"></a><div class='course-intro' style="margin-left: 0px;"><h2><a href="//m.sbmmt.com/m/course/582.html">独孤九贱(6)_jQuery视频教程</a></h2><p class='course-intro-info'>jQuery是一个快速、简洁的JavaScript框架。设计的宗旨是“write Less,Do More”,即倡导写更少的代码,做更多的事情。它封装JavaScript常用的功能代码,提供一种简便的JavaScript设计模式,优化HTML文档操作、事件处理、动画设计和Ajax交互。 核心特性可以总结为:具有独特的链式语法和短小清晰的多功能接口;具有高效灵活的css选择器,并且可对CSS选择器进行扩展;拥有便捷的插件扩展机制和丰富的插件。兼容各种主流浏览器,如IE 6.0+、FF 1.5+、Safari 2.0+、Opera 9.0+等,是全球最流行的前端开发框架之一。PHP中文网根据最新版本,独家录制jQuery最新视频教程,回馈PHP中文网的新老用户。</p><p><a href="//m.sbmmt.com/m/course/list/19.html"><span class='level'>jQuery教程</span></a><span class='count'>114694次播放</span></p></div></li><hr><li class='layui-clear' style="padding-left: 0px;"><a href="//m.sbmmt.com/m/course/1195.html" class="course-arctic-img"><img src='//m.sbmmt.com/img/upload/course/000/000/015/612f16c1e1c8e978.jpg' height="100%"></a><div class='course-intro' style="margin-left: 0px;"><h2><a href="//m.sbmmt.com/m/course/1195.html">jQuery与Ajax基础与实战</a></h2><p class='course-intro-info'>jQuery是最流行的JS函数库,封装了许多实用的功能,其中最引人入胜的就是Ajax。 jQuery中的Ajax操作,语法简单,操作方便,使Ajax从未如此轻松,前端人员从此不再为与服务器异步交互而发愁,本套课程,精选了最常用的几个方法,从基本的语法到每个参数,再到具体实例进行了全面的讲解。</p><p><a href="//m.sbmmt.com/m/course/list/25.html"><span class='level'>AJAX教程</span></a><span class='count'>14363次播放</span></p></div></li><hr><li class='layui-clear' style="padding-left: 0px;"><a href="//m.sbmmt.com/m/course/1313.html" class="course-arctic-img"><img src='//m.sbmmt.com/img/upload/course/000/000/015/617b8f8af2b97409.jpg' height="100%"></a><div class='course-intro' style="margin-left: 0px;"><h2><a href="//m.sbmmt.com/m/course/1313.html">Git教程(60分钟全程无废话版)</a></h2><p class='course-intro-info'>Git 是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。 Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。 Git 与常用的版本控制工具 CVS, Subversion 等不同,它采用了分布式版本库的方式,不必服务器端软件支持</p><p><a href="//m.sbmmt.com/m/course/list/17.html"><span class='level'>JavaScript教程</span></a><span class='count'>12361次播放</span></p></div></li><hr></ul></div><!-- <div class='discuss layui-clear bg-white'><h3>全部评论<span id='discuss-article'>我要评论</span></h3></div><div class='discuss-submit bg-white' url="//m.m.sbmmt.com/"><li class='info layui-clear'><span class='f-left' id='discuss-submit-close'>取消</span><span class='f-left'>发布评论</span><span class='f-right article-reply-publish' id="315477">发送</span></li><li class='layui-clear'><textarea type='text' rows="6" placeholder="请输入要评论的内容" class="article-reply-content-text"></textarea></li><li class='layui-clear'><button class="layui-btn layui-btn-danger f-right article-reply-publish-button">发布</button></li></div>--><div class='lock-screen' id='lock-screen'></div><div class='popimg-setting'><div>1/1</div><img src="" width='100%'></div><script src="//m.sbmmt.com/m/static/ueditor/third-party/SyntaxHighlighter/shCore.js"></script><script src="https://vdse.bdstatic.com//search-video.v1.min.js"></script><footer><a href='//m.sbmmt.com/m/' ><i class='layui-icon layui-icon-home '></i>首页</a><a href='//m.sbmmt.com/m/course.html' ><i class='layui-icon layui-icon-play'></i>视频</a><a href='//m.sbmmt.com/m/mk.html?t=2'><img src="//m.sbmmt.com/m/static/images/gif_live.gif" />直播</a><!-- <a href='//m.sbmmt.com/m/app/'><img src="//m.sbmmt.com/img/upload/article/000/000/003/6108e2ad07387877.png" style="width:20px;height:20px;" /><div style="margin-top:-5px;">下载</div></a>--><a href='//m.sbmmt.com/m/wenda.html' ><i class='layui-icon layui-icon-code-circle'></i>社区</a><a href='//m.sbmmt.com/m/login' ><i class='layui-icon layui-icon-username'></i>我的</a></footer><div class="headerMask"></div><div class="right_menu"><div class="right_menu_con" style="position:relative;"><h2 class="hjclass-txt"><i class="layui-icon layui-icon-shrink-right hjclass-txt-i"></i>PHP中文网</h2><div class="menu-list"><a href="//m.sbmmt.com/m/"><span class="item-icon item-1"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb65f99ae2304.png" alt="首页"></span> 首页</a><a href="//m.sbmmt.com/m/course.html"><span class="item-icon item-7"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb82bd09ad628.png" alt="课程"></span> 课程</a><a href="//m.sbmmt.com/m/article.html"><span class="item-icon item-4"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb7e111b3b425.png" alt="文章"></i></span>文章</a><a href="//m.sbmmt.com/m/wenda.html"><span class="item-icon item-2"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb83f04e24328.png" alt="问答"></span> 问答</a><a href="//m.sbmmt.com/m/blog.html"><span class="item-icon item-0"><img src="//m.sbmmt.com/m/static/images/ico/blog.png" alt="博客"></span>博客</a><a href="//m.sbmmt.com/m/dic.html"><span class="item-icon item-9"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb85047b25758.png" alt="词典"></span> 词典</a><a href="//m.sbmmt.com/m/course/type/99.html"><span class="item-icon item-3"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb8736ea90300.png" alt="手册"></span> 手册</a><a href="//m.sbmmt.com/m/xiazai/"><span class="item-icon item-5"><img src="//m.sbmmt.com/m/static/images/ico/resources.png" alt="资源"></span> 资源</a><a href="//m.sbmmt.com/m/search"><span class="item-icon item-6"><img src="//m.sbmmt.com/img/upload/article/000/000/003/5bffb880b460a204.png" alt="搜索"></span> 搜索</a><a href="//m.sbmmt.com/m/app/"><span class="item-icon item-6"><img src="//m.sbmmt.com/img/upload/article/000/000/003/608bbfa30d9cc398.png" style="width:35px;height:35px;" alt="APP下载"></span> APP下载</a></div><a href="//m.sbmmt.com/jump/go.php?url=https%3A%2F%2Fm.sbmmt.com%2Fmap%2F2.html&location=mob-mune-ad" style="display:block; position:absolute ; bottom:0px" target="_blank"><img src="//m.sbmmt.com/img/upload/aroundimg/000/000/001/62fdcfb67b3b8383.png" width="100%" /></a></div></div><script>isLogin = 0;</script><script type="text/javascript" src="//m.sbmmt.com/m/static/js/jquery.min.js"></script><script type="text/javascript" src="//m.sbmmt.com/m/static/layui/layui.js"></script><script type="text/javascript" src="//m.sbmmt.com/m/static/js/global.js?4.9.47"></script><script>(function () {var bp = document.createElement('script');var curProtocol = window.location.protocol.split(':')[0];if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';} else {bp.src = 'http://push.zhanzhang.baidu.com/push.js';}var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(bp, s);})();var _hmt = _hmt || [];(function() {var hm = document.createElement("script");hm.src = "https://m.sbmmt.com/hm.js?43f47cabf6856204df6d083dd89ae407";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm, s);})();</script><link rel='stylesheet' id='_main-css' href='//m.sbmmt.com/m/static/css/viewer.min.css' type='text/css' media='all'/><script type='text/javascript' src='//m.sbmmt.com/m/static/js/viewer.min.js?1'></script><script type='text/javascript' src='//m.sbmmt.com/m/static/js/jquery-viewer.min.js'></script><a href="//m.sbmmt.com/m/jump/go.php?url=https%3A%2F%2Fmp.weixin.qq.com%2Fs%2F0jGlSfhkXnyjThK4-HbYrw&location=mob-article-xuanfu" target="_blank" id="app_open" style="border-radius:50px; box-shadow: 0px 0px 10px red; background:red; display:none; text-align:center; width:200px; color:#fff; font-size:14px; padding:5px 10px 5px 10px; position:fixed; text-decoration:none; margin:0 auto; width:140px; bottom:10%;"> workerman实战课 </a><script>var open = 1; $(document).ready(function(){ var width = $(document).width(); var left = (width/2)-80; $('#app_open').css('left',left); // 滑动滚动条 $(window).scroll(function(){ var top = $(window).scrollTop(); // 滚动条距离顶部的距离 大于 200px时 if(top >= 400 && top <= 1000 && open > 0){ $('#app_open').css('display','block'); $('#app_open').fadeIn(1000); // 如果小于等于 200 淡出 //open = 0; //console.log('++'+open); } else if(top > 1400){ $('#app_open').fadeOut(1000); // 如果小于等于 200 淡出 //open = 0; //console.log('--'+open); } }); }) function windowsopen(){ var u = navigator.userAgent; var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; if(isiOS){ window.location.href = 'itms-apps://itunes.apple.com/app/id1401866843?action=write-review'; return; }else if(isAndroid){ if(is_weixin()){ window.location.href='//m.sbmmt.com/m/app/'; return; } } window.location.href='https://d.php.cn/phpcn.apk'; } </script><script> // function called if wwads is blocked function ABDetected() { document.getElementsByClassName("wwads-cn")[0].insertAdjacentHTML("beforeend", "<style>.wwads-horizontal,.wwads-vertical{background-color:#f4f8fa;padding:5px;min-height:120px;margin-top:20px;box-sizing:border-box;border-radius:3px;font-family:sans-serif;display:flex;min-width:150px;position:relative;overflow:hidden;}.wwads-horizontal{flex-wrap:wrap;justify-content:center}.wwads-vertical{flex-direction:column;align-items:center;padding-bottom:32px}.wwads-horizontal a,.wwads-vertical a{text-decoration:none}.wwads-horizontal .wwads-img,.wwads-vertical .wwads-img{margin:5px}.wwads-horizontal .wwads-content,.wwads-vertical .wwads-content{margin:5px}.wwads-horizontal .wwads-content{flex:130px}.wwads-vertical .wwads-content{margin-top:10px}.wwads-horizontal .wwads-text,.wwads-content .wwads-text{font-size:14px;line-height:1.4;color:#0e1011;-webkit-font-smoothing:antialiased}.wwads-horizontal .wwads-poweredby,.wwads-vertical .wwads-poweredby{display:block;font-size:11px;color:#a6b7bf;margin-top:1em}.wwads-vertical .wwads-poweredby{position:absolute;left:10px;bottom:10px}.wwads-horizontal .wwads-poweredby span,.wwads-vertical .wwads-poweredby span{transition:all 0.2s ease-in-out;margin-left:-1em}.wwads-horizontal .wwads-poweredby span:first-child,.wwads-vertical .wwads-poweredby span:first-child{opacity:0}.wwads-horizontal:hover .wwads-poweredby span,.wwads-vertical:hover .wwads-poweredby span{opacity:1;margin-left:0}.wwads-horizontal .wwads-hide,.wwads-vertical .wwads-hide{position:absolute;right:-23px;bottom:-23px;width:46px;height:46px;border-radius:23px;transition:all 0.3s ease-in-out;cursor:pointer;}.wwads-horizontal .wwads-hide:hover,.wwads-vertical .wwads-hide:hover{background:rgb(0 0 0 /0.05)}.wwads-horizontal .wwads-hide svg,.wwads-vertical .wwads-hide svg{position:absolute;left:10px;top:10px;fill:#a6b7bf}.wwads-horizontal .wwads-hide:hover svg,.wwads-vertical .wwads-hide:hover svg{fill:#3E4546}</style><a href='https://wwads.cn/page/whitelist-wwads' class='wwads-img' target='_blank' rel='nofollow'><img src='https://creatives-1301677708.file.myqcloud.com/images/placeholder/wwads-friendly-ads.png' width='130'></a><div class='wwads-content'><a href='https://wwads.cn/page/whitelist-wwads' class='wwads-text' target='_blank' rel='nofollow'>为了本站的长期运营,请将我们的网站加入广告拦截器的白名单,感谢您的支持!</a><a href='https://wwads.cn/page/end-user-privacy' class='wwads-poweredby' title='万维广告 ~ 让广告更优雅,且有用' target='_blank'><span>万维</span><span>广告</span></a></div><a class='wwads-hide' onclick='parentNode.remove()' title='隐藏广告'><svg xmlns='http://www.w3.org/2000/svg' width='6' height='7'><path d='M.879.672L3 2.793 5.121.672a.5.5 0 11.707.707L3.708 3.5l2.12 2.121a.5.5 0 11-.707.707l-2.12-2.12-2.122 2.12a.5.5 0 11-.707-.707l2.121-2.12L.172 1.378A.5.5 0 01.879.672z'></path></svg></a>"); }; //check document ready function docReady(t) { "complete" === document.readyState || "interactive" === document.readyState ? setTimeout(t, 1) : document.addEventListener("DOMContentLoaded", t); } //check if wwads' fire function was blocked after document is ready with 3s timeout (waiting the ad loading) docReady(function () { setTimeout(function () { if( window._AdBlockInit === undefined ){ ABDetected(); } }, 3000); }); </script><script> var returnCitySN = ''; document.getElementById("phpad").style.display="none"; document.getElementById("phpcontent").style.display="none"; document.getElementById("app_open").style.display="none"; </script><script type="text/javascript" charset="UTF-8" src="//m.sbmmt.com/ip/city.php?sign=46ef9db7dd62c6f499fd77639b3d1c5b"></script><script> function setCookie(name,value,iDay){ //name相当于键,value相当于值,iDay为要设置的过期时间(天) var oDate = new Date(); oDate.setDate(oDate.getDate() + iDay); document.cookie = name + '=' + value + ';path=/;domain=.php.cn;expires=' + oDate; } //读cookies function getCookiea(name) { var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)) return arr[2]; else return null; } var ad = getCookiea('ad'); if( returnCitySN == '' || encodeURIComponent(returnCitySN.cname).indexOf('%E6%96%B0%E7%96%86') != -1 || encodeURIComponent(returnCitySN.cname).indexOf('%E5%8C%97%E4%BA%AC') != -1) { $('#phpad').remove(); $('#phpcontent').remove(); $('#app_open').remove(); } else { setCookie('ad',1,1) document.getElementById("phpad").style.display=""; document.getElementById("phpcontent").style.display=""; document.getElementById("app_open").style.display=""; } </script><script>$('article').viewer({navbar:true,title:false,toolbar:false,movable:false,viewed:function(){$('img').click(function(){$('.viewer-close').trigger('click');});}});</script><script type="application/ld+json">{"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld","@id": "//m.m.sbmmt.com/article/315477.html","appid": "1549852514326010","title": "php汉字转码 GBK-&gt;Unicode(UTF8)编码转换 ","images": [""],"description": " php汉字转码 GBK-&gt;Unicode(UTF8)编码转换 ","pubDate": "2016-07-25T08:53:53","data": {"WebPage": {"headline": "php汉字转码 GBK-&gt;Unicode(UTF8)编码转换 ","wapUrl": "//m.m.sbmmt.com/article/315477.html","pcUrl": "//m.sbmmt.com/m/php-weizijiaocheng-315477.html","fromSrc": "php中文网","domain": "电子科技","category": ["问答"],"isDeleted": 0},"Question": [{"acceptedAnswer":" php汉字转码 GBK-&gt;Unicode(UTF8)编码转换 "}],"ImageObject": [{"contentUrl": "","scale": "5:2"}],"Author": [{"name": "php中文网","jobTitle": ["php公益学习平台"],"headPortrait": "https://img.php.cn/upload/article/000/000/003/5d1b23156bf94358.png"}]}}</script><script>$('.selectButton').hide();</script><script> var href = window.location.href; var title = document.title; var num = Math.floor(Math.random() * 10000 + 1); var newscript = document.createElement('script'); newscript.setAttribute('type','text/javascript'); newscript.setAttribute('src',"https://analyze.xm6wpp.com/index.php/api/statistics/phpcn?url="+encodeURIComponent(href)+"&title="+encodeURIComponent(title)+"&"+num); var head = document.getElementsByTagName('head')[0]; head.appendChild(newscript); </script></body></html>