开发者

URL Encoding in Flex and PHP

开发者 https://www.devze.com 2023-01-07 04:33 出处:网络
I have got a simple flex client requesting some data from a php script. I am using URLLoader to pass the parameters to the php and wait for the response. Since the value of the parameter can contain a

I have got a simple flex client requesting some data from a php script. I am using URLLoader to pass the parameters to the php and wait for the response. Since the value of the parameter can contain any character, I was using escape function on the flex side to pass the value to the php script. I figured out that flex escape does not work with all the character and php's equivalent urlencode have different results on the same data.

My question is how can I safely pass a string of characters(any) to the php script. One suggestion I got was to use POST instead of GET or to base 64 encode the string but base6开发者_JAVA技巧4 itself does not contain url safe characters...e.g + gets converted to blank in php.


Use encodeURIComponent for encoding string on a url. It will encode + and other characters in the variable.

this function assumes that it is processing a URI component it treats the special separator characters (; / ? : @ & = + $ , #) as regular text that should be encoded.

0

精彩评论

暂无评论...
验证码 换一张
取 消