一段PHP在地址栏的中文传值出现乱码 在IE下,中文传值,最后一个汉字变成了乱码,导致抓不出数据。但是在火狐里面又可以。传值页面,mysql,查询,接收值页面,均是UTF-8字库这是咋回事呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $T_class=$_GET['Tclass'];//这句从地址栏取值 echo $T_class;//这句打印IE里面“test天花板”变成了“test天花灠”火狐里面没问题。-----地址栏上还是显示:“test天花板” 把这个参数url_encode($name);一下接下来时再url_decode($_GET['Tclass']); 因为firefox自动识别了编码。在最后输出的页面指定一下编码header("Content-type: text/html; charset=utf-8"); 报错:Fatal error: Call to undefined function url_decode() in showClass.php on line 27这一行的内容是: $T_class=url_decode($_GET['Tclass']); 文件编码与浏览器编码都设为utf-8编码再试 //a.php <a href="b.php?Tclass=<?php echo urlencode('test天花板');?>">aaaa</a>//b.php$T_class=$_GET['Tclass']; echo urldecode($T_class); //test天花板 这个编码在引用文件里已经指定了。重新指定一次,就报错了:Warning: Cannot modify header information - headers already sent by (output started at D:\setup\xampp\htdocs\cn\require\head.php:86) 引用文件要全站调用的,header.php,也就是第一头部,相当于是所有输出之前声明编码 应该是这个,但是,我的传值页面的链接语法又出问题了: echo "<li> <a href='showClass.php?pclass=url_encode({$row[$T]})'>";//这行url_encode不起作用,直接当字符串出现在地址栏了 echo "$row[$i]"; echo "</a> </li>"; echo "<li> <a href='showClass.php?pclass=".urlencode($row[$T])."'>"; 1.引号内包含的表达式不会被解析。echo "<li> <a href='showClass.php?pclass=". url_encode($row[$T])."'>";2.是urlencode(), urldecode() 没有下划线。(许多人因此指责PHP的函数命名没有章法) PHP中关于flock的问题 php如何实现修改配置文件,加载执行一些命令。FREEBSD7+APACHE+PHP5 实现FTP服务TELNET服务 字符串名称如何转为php变量名? @mb_send_mail 函数发邮件,邮件服务器出错,发送失败后,为什么会跳出程序??也没有返回。。 正则问题请教 请问用mysql_create_db()函数会出错 工作两年多了,准备近期更换工作 php如何调用C语文程序,有例程吗??? 怎样让PHP定期执行一个程序 php-4.2.3-Win32.zip可以和apache_2.0.42配么 iis php空白页面 帮我解决个小问题,谢谢
$T_class=$_GET['Tclass'];//这句从地址栏取值 echo $T_class;//这句打印
IE里面“test天花板”变成了“test天花灠”火狐里面没问题。-----地址栏上还是显示:“test天花板”
接下来时再url_decode($_GET['Tclass']);
header("Content-type: text/html; charset=utf-8");
报错:
Fatal error: Call to undefined function url_decode() in showClass.php on line 27这一行的内容是: $T_class=url_decode($_GET['Tclass']);
<a href="b.php?Tclass=<?php echo urlencode('test天花板');?>">aaaa</a>//b.php
$T_class=$_GET['Tclass'];
echo urldecode($T_class); //test天花板
这个编码在引用文件里已经指定了。重新指定一次,就报错了:
Warning: Cannot modify header information - headers already sent by (output started at D:\setup\xampp\htdocs\cn\require\head.php:86)
引用文件要全站调用的,header.php,也就是第一头部,相当于是所有输出之前声明编码
应该是这个,但是,我的传值页面的链接语法又出问题了:
echo "<li> <a href='showClass.php?pclass=url_encode({$row[$T]})'>";//这行url_encode不起作用,直接当字符串出现在地址栏了
echo "$row[$i]";
echo "</a> </li>";
echo "<li> <a href='showClass.php?pclass=". url_encode($row[$T])."'>";
2.是urlencode(), urldecode() 没有下划线。(许多人因此指责PHP的函数命名没有章法)