试用了一把php的try catch极其失望,除了名字相同,其他的。。。比如:
try{
if(class_exists($act['action'])){
$obj=new $act['action']($act,$this->_pDate);
}else{
throw new Exception("");
}
}catch (Exception $e){
die("System error for wrong action mapping for this application");
}
居然需要自行throw。。。这就完全失去了try catch真正的意图了。。。
原因很清楚php是一种不允许错的语言,他的语句是“没有错误”的概念,所以try catch也就成了摆设。。。
try{
if(class_exists($act['action'])){
$obj=new $act['action']($act,$this->_pDate);
}else{
throw new Exception("");
}
}catch (Exception $e){
die("System error for wrong action mapping for this application");
}
居然需要自行throw。。。这就完全失去了try catch真正的意图了。。。
原因很清楚php是一种不允许错的语言,他的语句是“没有错误”的概念,所以try catch也就成了摆设。。。