Home > Backend Development > PHP Tutorial > 一段PHP在地址栏的汉语传值出现乱码

一段PHP在地址栏的汉语传值出现乱码

WBOY
Release: 2016-06-13 10:38:08
Original
808 people have browsed it

一段PHP在地址栏的中文传值出现乱码
在IE下,中文传值,最后一个汉字变成了乱码,导致抓不出数据。

但是在火狐里面又可以。

传值页面,mysql,查询,接收值页面,均是UTF-8字库

这是咋回事呢?

------解决方案--------------------
把这个参数url_encode($name);一下
接下来时再url_decode($_GET['Tclass']);
------解决方案--------------------

PHP code
//a.php <a href="b.php?Tclass=<?php%20echo%20urlencode('test%E5%A4%A9%E8%8A%B1%E6%9D%BF');?>">aaaa</a>//b.php$T_class=$_GET['Tclass']; echo urldecode($T_class);  //test天花板<br><font color="#e78608">------解决方案--------------------</font><br>echo "
Copy after login
  • ";
    ------解决方案--------------------
    1.引号内包含的表达式不会被解析。
    PHP code
    echo "
    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