因此,根据$ _GET变量是否传递给页面,我的页面会有所不同。
我的网址:
/page.php?one=hello&two=world
我在这里检查URL是否缺少任何GET变量:
if(empty($_GET["one"]) || empty($_GET["two"])){
//My url is missing crucial information.
//Send user to /page.php without GET variables
}else{
//Excellent. My GET variables exist.
//User stays on /page.php?one=hello&two=world
}
但是这创造了无限循环。如果用户在没有GET变量的情况下直接访问/page.php,则只需将其重定向回/page.php。
答案 0 :(得分:0)
if(isset($_GET['one'])||isset($_GET['two'])){
.......//Something
}else{
.......//something
}
这会有效!