admin 管理员组文章数量: 1087747
php 简转繁体,php 繁体字转化为简体字
1.php加载mbstring
extension=php_mbstring.dll
2.配置mbstring
[mbstring]
; language for internal character representation.
; .language
mbstring.language = Chinese
; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
; .internal-encoding
mbstring.internal_encoding =UTF-8
; http input encoding.
; .http-input
mbstring.http_input = auto
; http output encoding. mb_output_handler must be
; registered as output buffer to function
; .http-output
mbstring.http_output = UTF-8
; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
; portable libs/applications.
; .encoding-translation
mbstring.encoding_translation = On
3.我的代码:
function fantigetjianti($str) {
$fantis = "";
include "fanti2jiantiData.php"; //加载繁体字数组
for ($i = 0; $i <= mb_strlen($str); $i++) {
$fanti = mb_substr($str, $i, 1);
$jianti = $fantiData[$fanti];
if (empty($jianti)) {
$jianti = $fanti;
}
$fantis .=$jianti;
}
return $fantis;
}
本文标签: php 简转繁体 php 繁体字转化为简体字
版权声明:本文标题:php 简转繁体,php 繁体字转化为简体字 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/b/1694436161a252020.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论