如何在php中更正此开关大小写?
请告诉我如何填写此开关代码:如何在php中更正此开关大小写?,php,switch-statement,Php,Switch Statement,请告诉我如何填写此开关代码: switch ($urlcomecatid) { case "50": case "51": case "52": case "109": case "110": do nothing and exit from switch otherwise: header ("Location:http://www.mysite.com/tech/tech.php"); break; } 不执行任何操作并退出开关 break switch块中的break关键字意味
switch ($urlcomecatid) {
case "50":
case "51":
case "52":
case "109":
case "110":
do nothing and exit from switch
otherwise:
header ("Location:http://www.mysite.com/tech/tech.php");
break;
}
不执行任何操作并退出开关
break代码>
switch
块中的break
关键字意味着退出此块并在switch
块后继续执行
并使用默认值:
而不是,否则:
默认案例匹配其他指定案例未匹配的所有其他案例
switch ($urlcomecatid) {
case "50":
case "51":
case "52":
case "109":
case "110":
break;
default:
header ("Location:http://www.mysite.com/tech/tech.php");
break;
}
不执行任何操作并退出开关
break代码>
switch
块中的break
关键字意味着退出此块并在switch
块后继续执行
并使用默认值:
而不是,否则:
默认案例匹配其他指定案例未匹配的所有其他案例
switch ($urlcomecatid) {
case "50":
case "51":
case "52":
case "109":
case "110":
break;
default:
header ("Location:http://www.mysite.com/tech/tech.php");
break;
}
break
关键字将在switch语句中结束处理
如果所有案例都不匹配,则将执行默认
块
switch ($urlcomecatid) {
case "50":
case "51":
case "52":
case "109":
case "110":
//do nothing and exit from switch
break;
default:
header ("Location:http://www.mysite.com/tech/tech.php");
exit(); // this line shouldn't be needed but it's good practice
break;
}
break
关键字将在switch语句中结束处理
如果所有案例都不匹配,则将执行默认
块
switch ($urlcomecatid) {
case "50":
case "51":
case "52":
case "109":
case "110":
//do nothing and exit from switch
break;
default:
header ("Location:http://www.mysite.com/tech/tech.php");
exit(); // this line shouldn't be needed but it's good practice
break;
}
PHP有关于switch语句的文档->阅读文档如何?PHP有关于switch语句的文档->阅读文档如何?感谢所有答案,我测试了所有内容,需要函数exit()。我以前遇到过这个问题,header()之后的exit()始终是必需的!感谢所有的答案,我测试了所有的,函数exit()是必需的。我以前遇到过这个问题,header()之后的exit()总是必需的!