PHP:合并捕获

时间:2009-11-21 20:04:14

标签: php exception

我可以在PHP中合并两个捕获吗?

try {
  // some code
}
catch (App_Exception $e) {
  // do sth.
}
catch (Exception $e) {
  // do the same exception code again
}

1 个答案:

答案 0 :(得分:0)

try {
    try {
        // some code
    }
    catch (App_Exception $e) {
        // do sth.
        throw $e;
    }
}
catch (Exception $e) {
    // do the same exception code again
}