异常滑动异常处理程序 [英] Exception slipping exception handler

查看:156
本文介绍了异常滑动异常处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面中有以下例外:

I got the following exception in my page:

Fatal error: Call to a member function someFunction() on a
    non-object in seomfile.php on line 15

我第15行附近的代码是: / p>

My code near line 15 is:

try
{
    return getObject()->someFunction(); // line 15
}
catch(Exception $e) { }

我知道 getObject()返回null,但为什么不尝试块捕获它?

I know getObject() returns null, but why isn't the try block catching it?

推荐答案

PHP混合异常和错误。您可以使用 set_error_handler()错误地抛出异常

PHP mixes Exceptions and Errors. You could use set_error_handler() to throw an exception on error.

这篇关于异常滑动异常处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆