PHP switch with GET request

后端 未结 6 1997
南旧
南旧 2021-02-03 16:12

I am building a simple admin area for my site and I want the URLs to look somewhat like this:

http://mysite.com/admin/?home
http://mysite.com/admin/?settings
htt         


        
6条回答
  •  清酒与你
    2021-02-03 16:29

    As well as the ones mentioned, another option would be key($_GET), which would return the first key of the $_GET array which would mean it would work with URLs with other parameters

    www.example.com/?home&myvar = 1;

    The one issue is that you may want to use reset() on the array first if you have modified the array pointer as key returns the key of the element array pointer is currently pointing to.

提交回复
热议问题