PHP开关语句错误
我创建了一个站点,添加了一个pm,当我转到pm.php时,它会给我一个错误: 致命错误:Switch语句在第673行的/home/vol10_3/HIDDEN.com/HIDDEN/htdocs/includes/classes/pm.class.php中只能包含一个默认子句 代码:PHP开关语句错误,php,switch-statement,Php,Switch Statement,我创建了一个站点,添加了一个pm,当我转到pm.php时,它会给我一个错误: 致命错误:Switch语句在第673行的/home/vol10_3/HIDDEN.com/HIDDEN/htdocs/includes/classes/pm.class.php中只能包含一个默认子句 代码: 实际上,您并没有像那样使用括号或默认值 <?php switch ($type) { case 'pm': // Do something when $type is 'pm'
实际上,您并没有像那样使用括号或默认值
<?php
switch ($type) {
case 'pm':
// Do something when $type is 'pm'
// This can be multiple statements
break;
case 'notification':
// Do something when $type is 'notification'
// This can be multiple statements
break;
default:
// Do something else
break;
}
与错误状态相同。如果您还没有阅读手册,请阅读手册。我将投票结束这个问题,因为错误消息完全是不言自明的。
<?php
switch ($type) {
case 'pm':
// Do something when $type is 'pm'
// This can be multiple statements
break;
case 'notification':
// Do something when $type is 'notification'
// This can be multiple statements
break;
default:
// Do something else
break;
}