Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php中更正此开关大小写?_Php_Switch Statement - Fatal编程技术网

如何在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()总是必需的!