Check query string (PHP)

后端 未结 5 1955
闹比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 21:58

    test.php?a=23?var=123 (this is a bad link, redirect to index..)

    In this case, you only have one variable sent, named "a" containing the value "a?var=123", therefore it shouldn't be a problem for you.

    test.php?var=123132&a=23 (this is a bad link, redirect to index..)

    In this case you have two variables sent, ("a" and "var").

    In general you can check the $_GET array to see how many variables have been sent and act accordingly, by using count($_GET).

提交回复
热议问题