博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PHP——字符串统一转码为GBK,自动判断是否UTF8并转码
阅读量:7227 次
发布时间:2019-06-29

本文共 372 字,大约阅读时间需要 1 分钟。

public static function strToGBK($strText)    {        $encode = mb_detect_encoding($strText, array('UTF-8','GB2312','GBK'));        if($encode == "UTF-8")        {            return @iconv('UTF-8','GB18030',$strText);        }        else        {            return $strText;        }    }
mb_detect_encoding:检测字符的编码

 

转载于:https://www.cnblogs.com/longzhongren/p/5910431.html

你可能感兴趣的文章
The DCI Architecture: A New Vision of Object-Oriented Programming(一篇具有里程碑式意义的论文)...
查看>>
RIP路由配置实例V2
查看>>
Bytescout Spreadsheet SDK for.NET
查看>>
我的友情链接
查看>>
Haproxy的三种保持客户端会话保持方式
查看>>
iOS的数学函数
查看>>
python 模块 chardet下载及介绍(转)
查看>>
能力工场--关于在JavaScript中使用EL表达式的问题
查看>>
NFS服务器设置
查看>>
s:iterator 中的status 使用方法
查看>>
cocos2d-x 源码剖析系列
查看>>
IT系统架构设计
查看>>
Nginx虚拟主机配置实践(一)
查看>>
细谈Spring(一)spring简介
查看>>
网络工程师的面试题
查看>>
nginx启动脚本
查看>>
常用输入法框架简介
查看>>
记录新机房建设。20130629
查看>>
安装ntop
查看>>
ssh远程登录讲解
查看>>