Check query string (PHP)

后端 未结 5 2009
闹比i
闹比i 2021-01-14 21:21

I use a query string, for example test.php?var=1.

How can I check if a user types anything after that, like another string...

I try to redirect

5条回答
  •  灰色年华
    2021-01-14 22:11

    Similar to Tom Haigh’s answer, you could also get the difference of the arguments you expect and those you actually get:

    $argKeys = array_keys($_GET);
    $additionalArgKeys = array_diff($argKeys, array('var'));
    var_dump($additionalArgKeys);
    

提交回复
热议问题