首页 > 解决方案 > set_error_handler,捕获所有返回错误的函数

问题描述

我有一个自定义异常类。

而且我已经将我的错误处理程序设置为调用一个自定义的包罗万象的函数,然后它会抛出一个错误。

class customError extends exception {}

function catchall($number, $message, $file, $line) {
    throw new customError($number, $message, 0, $file, $line);
}
set_error_handler('catchall', -1 & ~E_NOTICE & ~E_USER_NOTICE);

我收到以下错误:Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])

标签: php

解决方案


推荐阅读