Warning: file_get_contents() [function.file-get-contents]: SSL: 远程主机强迫关闭了一个现有的连接。 in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884

Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
php编码转换:gbk和utf-8的互转 - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


https://www.cnblogs.com/zhangqie/p/8256876.html

这个不错,简洁又有效。


实测记录:

A.php是utf-8编码,B.php是gbk编码。

A的变量内容通过session传到B中时,汉字部分出现乱码,用上文的函数将utf8转为gbk后问题解决。


utf8 -> gbk

$str_gbk = iconv("UTF-8","gbk//TRANSLIT",UTF-8字符串);


gbk -> utf8

$str_utf8 = iconv('GB2312', 'UTF-8', GBK字符串);




返回首页


Copyright (C) 2018-2024 huidong