Home  >  Article  >  Backend Development  >  关于php get方法传递中文参数显示乱码有关问题

关于php get方法传递中文参数显示乱码有关问题

WBOY
WBOYOriginal
2016-06-13 13:06:131227browse

关于php get方法传递中文参数显示乱码问题
问题概述:用get方法传递参数,参数中带中文,提交页面在获取参数值后显示时出现乱码,页面编码是UTF-8。

详细说明:
1.同样的代码,本机测试中文可以正常显示,而服务器上则不行;
2.针对php中文参数传递乱码的问题解决,网上搜索的方法:iconv和mb_convert_encoding都尝试过,均无效(注意:本机中文显示正常可没有经过任何转码处理);
3.页面上输出的乱码如:%E7%94%B1%E6%9D%A5,测试用的中文是:由来。

烦知道的朋友指点下,谢谢!

------解决方案--------------------
URL参数为啥不适用URLENCODE?
------解决方案--------------------
%E7%94%B1%E6%9D%A5 不是乱码,是经 urlencode 编码后的串
echo urldecode('%E7%94%B1%E6%9D%A5'); //由来

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