urlencode和rawurlencode的区别

摘自http://blog.csdn.net/doggie1024/article/details/5698615

 

urlencode:返回字符串,此字符串中除了 -_. 之外的所有非字母数字字符都将被替换成百分号(% )后跟两位十六进制数,空格则编码为加号(+ ) 。

rawurlencode:功能和urlencode基本一样,采用的是RFC1738编码,因此空格会编码为%20 。

eg:
echo 'sales and marketing/Miami';
echo "<br>";
echo rawurlencode('sales and marketing/Miami');
echo "<br>";
echo urlencode('sales and marketing/Miami');

 

output:
sales and marketing/Miami
sales%20 and%20 marketing%2FMiami         (rawurlencode)
sales+ and+ marketing%2FMiami             (urlencode)

 

posted @ 2015-03-19 14:43  笑月儿  Views(153)  Comments(0Edit  收藏  举报