PHP switch with GET request

后端 未结 6 2061
南旧
南旧 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:45

    Is not the most "elegant" way to do it but the simplest form to answer your question is..

    
        if (isset($_GET['home'])):  
            # show index..  
        elseif (isset($_GET['settings'])):  
            # settings...  
        elseif (isset($_GET['users'])):  
            # user actions..  
        else:  
            # default action or not...  
        endif;
    
    

提交回复
热议问题