PHP形同虚设的TRY CATCH

[不指定 2007/08/30 19:07 | by edwardproAdmin ]
| |
试用了一把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也就成了摆设。。。
PHP日记 | 评论(0) | 引用(0) | 阅读(1109)
发表评论
表情
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]