赵荣涛's Archivers

From admin on 2011-06-14 12:39:06

url地址栏传中文值乱码问题与解决方法

//方法一 urlencode
$url = 'abc.php?n='.urlencode("大众网");

//方法二base64_encode
$test="大众网";
$test1=base64_encode($test);
echo base64_decode($test1);

//方法三让服务器支持中文
[root@dhcp ~]# locale
lang=zh_cn.utf-8
lc_ctype="zh_cn.utf-8"
lc_numeric="zh_cn.utf-8"
lc_time=c
lc_collate=c
lc_monetary="zh_cn.utf-8"
lc_messages="zh_cn.utf-8"
lc_paper="zh_cn.utf-8"
lc_name="zh_cn.utf-8"
lc_address="zh_cn.utf-8"
lc_telephone="zh_cn.utf-8"
lc_measurement="zh_cn.utf-8"
lc_identification="zh_cn.utf-8"
lc_all=
[root@dhcp ~]#

查看完整版本: url地址栏传中文值乱码问题与解决方法

Tags: