开发者

CodeIgniter PHP Exceptions

I've been wondering what's the best way to deal with exceptions on CodeIgniter. The usual way is to use trigger_error() or log_message(), however I've been wondering if there's a better way usi开发者_StackOverflow中文版ng try/catch.

Any tips or recommendations on how to implement this into CodeIgniter?

Currently I'm extending the Exceptions Class, but I would like to know if someone else already dealt with this problem before.


I would do something as simple as:

try { $this->load->model('modelname'); }

catch ( Exception $e )
{
    show_error($e);
}

If you application is environment aware then I would show_error() on local, email error on live. This functionality could even be added into MY_Model to work generically for all models.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜