Question mark in the middle of a url variable?

前端 未结 3 456
梦如初夏
梦如初夏 2020-11-30 07:23

If I have a variable to pass through a url and it has a question mark in it, do I just need to escape the question mark? If not how can I make sure it passes through like it

3条回答
  •  悲哀的现实
    2020-11-30 07:54

    Here's a full list of URL encoding characters. If you're using PHP for a server side language, you can use something like...

    $nice_url = urlencode("http://your.old.url");
    

    Other languages will have similar functions build in (or you can find one online). This will take care of your question mark (and other url issues).

提交回复
热议问题