【发布时间】:2014-10-06 01:11:00
【问题描述】:
我目前有以下 PHP,它使用 try/catch 块检查异常。
try {
$obj->login('User', 'Pass');
$obj->joinServer('Server');
} catch(ConnectionException $objException){
die();
}
...这是 ConnectionException 类:
class ConnectionException extends Exception {
public function __construct($strError, $intError, $mixOther = null){
$this->strError = $strError;
$this->intError = $intError;
echo $this->intError, ' - ', $this->strError, chr(10);
}
}
现在假设“catch”部分返回特定错误(如果ConnectionException 输出特定消息),我如何再次“重试”try/catch?
【问题讨论】:
-
这里有一个比较热门的相关问题:stackoverflow.com/q/25002164/470749
标签: php class exception try-catch