Home > Backend Development > PHP Tutorial > 关于url碥码,该如何解决

关于url碥码,该如何解决

WBOY
Release: 2016-06-13 12:03:40
Original
1256 people have browsed it

关于url碥码

<br />$str="%C3%F7%D0%C7%CD%AC%BF%EE%D7%B0%B1%B8";<br />$str=urldecode($str); <br />
Copy after login

如果我这上面两行代码保存在gbk就显示正示,如果保存成utf就显示不正常,这是什么为什么呢?
代码应该怎么定在在保存为utf的情况下正常呢
------解决方案--------------------
可用iconv把gbk轉utf8
<br />$str="%C3%F7%D0%C7%CD%AC%BF%EE%D7%B0%B1%B8";<br />$str=urldecode($str); <br />$str=iconv("GBK", "UTF-8", $str); 
echo $str;
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template