我的url:
.......index.php?action=search&start=12&search=star wave&orderby=categories&showtype=pageshttp://www.makaidong.com/share123/admin/editposts.aspx?opt=1
我的简单code:
print_r($_get['search']);exit();
浏览器中结果显示:star%20wave
查阅相关资料:发现在php中可以用 urldecode() 和 rawurldecode()进行解码,它们可以将已编码字符串中的任何 %##进行解码。解码输出结果:starwave
相应的,在php中对url进行编码,可以使用 urlencode() 或者 rawurlencode(),二者的区别是前者把空格编码为 '+',而后者把空格编码为 '%20'。