【发布时间】:2014-09-06 09:57:43
【问题描述】:
如何处理方法抛出的异常?该方法必须在方法'check'中没有抛出异常
<?php
class AllAccidents
{
public static function check() {
try {
$x = 1;
if($x)
throw new Exception("Value must be more than 1");
}catch (Exception $e){
echo "hello>>".$e->getMessage();
}
}
}
class Test
{
public function go(){
try{
AllAccidents::check();
} catch (Exception $e){
}
}
}
$obj = new Test();
$obj->go();
?>
【问题讨论】:
标签: php exception error-handling