我试图捕获错误腓catch异常
try
{
$outcome = $bet->getElementsByTagName("Outcome");
$line1 = $outcome->item(0)->getElementsByTagName("OptionalValue1")->item(0)->nodeValue;
$line2 = $outcome->item(2)->getElementsByTagName("OptionalValue1")->item(0)->nodeValue;
$aOdds["line"] = ($line1 == 0) ? -$line2 : $line1;
$aOdds["q1"] = $outcome->item(0)->getAttribute("odds");
$aOdds["qx"] = $outcome->item(1)->getAttribute("odds");
$aOdds["q2"] = $outcome->item(2)->getAttribute("odds");
}
catch (Exception $e)
{
$outcome = $bet->getElementsByTagName("Outcome");
$line1 = $outcome->item(0)->getElementsByTagName("OptionalValue1")->item(0)->nodeValue;
$line2 = $outcome->item(1)->getElementsByTagName("OptionalValue1")->item(0)->nodeValue;
$aOdds["line"] = ($line1 == 0) ? -$line2 : $line1;
$aOdds["q1"] = $outcome->item(0)->getAttribute("odds");
$aOdds["qx"] = 0;
$aOdds["q2"] = $outcome->item(1)->getAttribute("odds");
}
一些数据配备了2相同的标记,并与3人,我想赶上如果不存在3.标签,但错误捕捉不到真正的工作。
你能不能细说 “没有真正的工作?” – 2011-04-26 19:16:09
某些事情必须真正抛出异常,才能够抓住它。 – 2011-04-26 19:35:18
啊,我明白了:) – 2011-04-26 19:44:21