简体   繁体   中英

encoding URL parameter in Ruby, and correctly decoding it with php

I want to encode an URL parameter with Ruby. The URL parameter not encoded is like this:

index.php?hash=tlNmgzWNFelvIH1o9ZAWFifpB3RwZOh6DCt5OdIfJCWLo9iZSRONWk1D1rEnSxUp|hi8JcsAHkznPkDFfaS1+xw==

Then I want to decode it from PHP!

I tried ruby:

ERB::Util::url_encode(param)

And then in Php urldecode($param); does not seem to work!

Use CGI::escape on rubyside.

http://ruby-doc.org/stdlib-1.9.3/libdoc/cgi/rdoc/CGI.html#method-c-escape

url_encoded_string = CGI::escape("'Stop!' said Fred")
   # => "%27Stop%21%27+said+Fred"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM