URL as URL's get parameters - problem with “&”

前端 未结 3 1627
猫巷女王i
猫巷女王i 2021-01-24 16:10

There is script that receives another url as GET parameter:

script.php?file=http://www.google.com&id=123

The problem is:
when url has p

3条回答
  •  终归单人心
    2021-01-24 16:51

    You need to URL encode the entire URL that you are passing as a parameter to another url (your script). %26 is the correct encoding for an &. Just make sure you decode it server-side before using it. You don't say what language(s) you're using, but most, inc javascript and php have native URL encoding functions.

提交回复
热议问题