加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – set_error_handler函数不调用autoload

发布时间:2020-12-13 17:02:12 所属栏目:PHP教程 来源:网络整理
导读:我有set_error_handler()函数设置为在出现错误时调用函数. 在该函数中,我有自己的异常类实现: function acs_error_handler($errno,$errstr,$errfile,$errline) { throw new acs_exception($errstr,$errno); } 这给了我以下错误: Fatal error: Class ‘acs_
我有set_error_handler()函数设置为在出现错误时调用函数.

在该函数中,我有自己的异常类实现:

function acs_error_handler($errno,$errstr,$errfile,$errline) {    
    throw new acs_exception($errstr,$errno);     
}

这给了我以下错误:

Fatal error: Class ‘acs_exception’ not found

出于某种原因,此功能不会调用我使用以下设置的自动加载功能:

spl_autoload_register('__autoload');

如果我添加该行:

__autoload('acs_exception');

在错误函数中调用类之前,一切正常.

我的问题是:当我在错误触发函数中调用acs_exception类时,__autoload()函数不应该触发吗?

解决方法

Here’s a related PHP bug report.

Your error is triggered at
compile-time,which disables autoload
(and spl_autoload at the same time).

Won’t be fixed for PHP5.3 as it may cause lots of other problems.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读