Thread
:
在php中进行gb2312与utf-8的互换
View Single Post
#
2
IP: 59.60.149.98
2008-05-01, 09:52 AM
car
高级会员
Join Date: 2006-05-14
Posts: 534
转换gb2313为utf-8
<?
$text = "例子";//$text此字符串必须为GB2312编码,如果系统环境为utf-8,执行此段代码无法达到预期效果
preg_match_all("/[\x80-\xff]?./",$text,$ar);
foreach($ar[0] as $v)
echo iconv("GB2312","UTF-8",$v);
?>
car
View Public Profile
Send a private message to car
Find all posts by car