Home >Backend Development >PHP Tutorial >PHP编码转换_PHP

PHP编码转换_PHP

WBOY
WBOYOriginal
2016-06-01 12:09:06919browse

SELECT COLLATIONPROPERTY('Chinese_PRC_Stroke_CI_AI_KS_WS', 'CodePage')

返回为936,即GBK编码。

936 简体中文GBK
950 繁体中文BIG5
437 美国/加拿大英语
932 日文
949 韩文
866 俄文
65001 unicode UFT-8

如果字段有中文,PHP文件设置编码为GBK2312,则取数据库信息时没有问题:

print_r($rs["客户编码"]);

如果PHP文件设置编码为utf-8,则会报告错误。

如果非要把php文件的编码设置为utf-8,则需要转换一下编码:

print_r($rs[mb_convert_encoding("客户编码","GBK","UTF-8")]);//打印记录数组

这样就没有问题了。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn