Is it a bad practice to use a GET parameter (in URL) with no value?

前端 未结 3 1716
野性不改
野性不改 2021-01-01 16:07

I\'m in a little argument with my boss about URLs using GET parameters without value. E.g.

http://www.example.com/?logout

I see this kind of lin

3条回答
  •  囚心锁ツ
    2021-01-01 16:25

    It's perfectly fine, and won't cause any error. Though, nowadays most frameworks are MVC based, so in the URL you need to mention a controller and an action, so it looks more like /users/logout (BTW, also StackOverflow uses that URL to log users out ;).

    The statement that it may cause errors to me sounds like your applications manually access the raw $_GET, and I definitely think that building apps without a framework (which usually provides an MVC stack and a router/dispatcher) is the real dangerous thing here.

提交回复
热议问题