Select case Request("action")

来源:百度知道 编辑:UC知道 时间:2024/05/20 15:30:28
ASP中的
Select case Request("action")
case "step1"
case "step2"
case "step3"

在PHP里应该怎么写啊

switch($_POST("action")){
case "1":...
case "2":...
case "3":...
}

switch($_GET["action"]){
case "step1" : statement1; break;
case "step2" : statement2; break;
case "step3" : statement3; break;
default : statement; break;
}

记住每个都要加break, 否则,, 找到对应的case后会按顺序执行下来..

如果
switch($_GET["action"]){
case "step1" : statement1;
case "step2" : statement2;
case "step3" : statement3;
default : statement;
}

action值为 step2 的话
会执行 statement2, statement3, statement