请帮我纠正这段代码,我想把它放在内部切换:
switch ($urlcomecatid) {
if ($urlcomeparentid == 1 || $urlcomeparentid == 2 || $urlcomeparentid == 3)
break;
case "50":
case "51":
case "52":
case "109":
case "110":
//do nothing and exit from switch
break;
default:
header ("Location:http://www.example.com/tech/tech.php"); exit();
break;
}
解决方法:
正确的代码应该是这样的
switch ($urlcomecatid) {
case "50":
case "51":
case "52":
case "109":
case "110":
//do nothing and exit from switch
break;
default:
if ($urlcomeparentid == 1 || $urlcomeparentid == 2 || $urlcomeparentid == 3)
break;
header ("Location:http://www.example.com/tech/tech.php"); exit();
break;
}
标签:php,switch-statement
来源: https://codeday.me/bug/20190530/1186460.html