PHP if not statements

后端 未结 7 2129
南方客
南方客 2020-12-17 10:46

This may be the way my server is set up, but I\'m banging my head against the wall. I\'m trying to say that if $action has no value or has a value that is not \

7条回答
  •  鱼传尺愫
    2020-12-17 11:12

    Not an answer, but just for the sake of code formatting

    if((isset($_GET['a'])) $action=$_GET['a']; else $action ="";
    if(!($action === "add" OR $action === "delete")){
      header("location: /index.php");
      exit;
    }
    

    Note the exit; statement after header(). That's the important thing. header() does not terminate script execution.

提交回复
热议问题