Parameter separator in URLs, the case of misused question mark

前端 未结 3 2101
無奈伤痛
無奈伤痛 2021-01-11 09:27

What I don\'t really understand is the benefit of using \'?\' instead of \'&\' in urls:

\"question

3条回答
  •  醉话见心
    2021-01-11 10:15

    The answer's pretty much in this article - http://www.skorks.com/2010/05/what-every-developer-should-know-about-urls/ . To highlight it, here goes :

    Query is the preferred way to send some parameters to a resource on the server. These are key=value pairs and are separated from the rest of the URL by a ? (question mark) character and are normally separated from each other by & (ampersand) characters. What you may not know is the fact that it is legal to separate them from each other by the ; (semi-colon) character as well. The following URLs are equivalent:

    http://www.blah.com/some/crazy/path.html?param1=foo¶m2=bar

    http://www.blah.com/some/crazy/path.html?param1=foo;param2

提交回复
热议问题