Home > Backend Development > PHP Tutorial > urlencode转义字符串的有关问题

urlencode转义字符串的有关问题

WBOY
Release: 2016-06-13 13:47:08
Original
805 people have browsed it

urlencode转义字符串的问题
a.php:

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
  $str = urlencode('张三');
  echo "<a href="b.php?name=%7B%24str%7D">查看</a>";

Copy after login


b.php:
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
  $name = $_GET['name'];
  echo $name;

Copy after login


问题:
在a页面的源文件中查看超链接:查看
但点击超链接到b页面,却直接输出:张三
为什么反转义了?

谢谢!

------解决方案--------------------
是的。浏览器会自动帮你解码。用urldecode()解码也可。
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