1

On server:

Browser Url--->http://www.mysite.com/?email=external%2Buser%40gmail.com

Email passed in browser--->external%2Buser%40gmail.com 

Email After Encode--->external%5Euser%40gmail.com /* using urlencode function */

Email After Decode--->external^user@gmail.com /* using urldecode function */

On Localhost:

Browser Url--->http://localhost/test.php?email=external%2Buser%40gmail.com

Email passed in browser--->external%2Buser%40gmail.com

Email After Encode--->external%2Buser%40gmail.com /* using urlencode function */

Email After Decode--->external+user@gmail.com /* using urldecode function */

In above code i don't know why server result is different than localhost. on server %2B(+) is converted into %5E(^) while urlencode. I want same result as localhost. Please help me on this.

4

2 回答 2

2

你最好使用rawurldecode()代替urldecode()rawurlencode()代替urlencode()

于 2012-12-26T06:15:09.770 回答
0

This is most likely to the different character encoding on your server and localhost

Try converting them to a common character set as

urlencode( utf8_decode($strContent) );
于 2012-12-26T05:09:55.447 回答