涉及switch语句的PHP函数的问题

时间:2013-02-15 02:08:09

标签: php switch-statement

我收到语法错误,“意外”:'第38行',我无法弄明白:

public static function clearTasks($type){
    $con = taskDB::connectDB();

    switch ($type){
        /* line 38: */
        case: 'completed':
            $type='=1';
            break;
        case: 'failed':
            $type='=0';
            break;
        case: 'pending':
            $type='is null';
            break;
        case: 'all':
            $type='=1 or completed=0 or is null';
            break;
    }
    $result = $con->query("DELETE FROM taskage WHERE completed".$type);
    $con->close();  
}

谁能告诉我为什么会这样?谢谢!

1 个答案:

答案 0 :(得分:3)

:

之后没有case
case: 'completed':

应该是

case 'completed':