【发布时间】:2016-07-16 19:28:09
【问题描述】:
我正在查询一大堆地址,有些在线,有些不在线。但是,我似乎无法解决此错误,即使捕获异常也会失败:(
dns_get_record(): A temporary server error occurred.
try {
$result = dns_get_record('_minecraft._tcp.' . $addr, DNS_SRV);
}
catch (Exception $e) {
return [$addr,$port];
}
如果发生此错误,我想继续执行脚本,跳过记录,但目前脚本只是暂停。
任何帮助表示赞赏!
【问题讨论】:
-
定义
catching the exception fails,它甚至会抛出异常吗?除非它抛出异常或致命错误,否则脚本不应停止。 -
我收到一个 500 错误,返回:dns_get_record(): 发生临时服务器错误。
-
检查网络服务器日志文件
-
对不起,我得到 200 OK 并出现 ErrorException (E_UNKNOWN) dns_get_record(): 发生临时服务器错误。
-
那么你捕捉到了错误的异常。你需要抓住
ErrorException。