TP5自定义全局异常处理,重新handle的render方法之后出现如下错误:
( ! ) Fatal error: Uncaught think\exception\ErrorException: Declaration of app\lib\exception\ExceptionHandler::render(think\Exception $ex) should be compatible with think\exception\Handle::render(Exception $e) in /users/jackie/WWW/carpic/server/application/lib/exception/ExceptionHandler.php on line 10
( ! ) think\exception\ErrorException: Declaration of app\lib\exception\ExceptionHandler::render(think\Exception $ex) should be compatible with think\exception\Handle::render(Exception $e) in /users/jackie/WWW/carpic/server/application/lib/exception/ExceptionHandler.php on line 10
Call Stack
#TimeMemoryFunctionLocation
10.06981920984think\Error::appException( ).../Error.php:0
20.06981920984think\Error::getExceptionHandler( ).../Error.php:43
30.06981921008class_exists ( ).../Error.php:109
40.06981921072spl_autoload_call ( ).../Error.php:109
50.06981921136think\Loader::autoload( ).../Error.php:109
60.06981921280think\__include_file( ).../Loader.php:58
70.07011923232include( '/users/jackie/WWW/carpic/server/application/lib/exception/ExceptionHandler.php' ).../Loader.php:562
80.07061961984think\Error::appError( ).../ExceptionHandler.php:10
"~~~~~"
测试错误信息能正常输出,但是出现致命错误提示;然后看了下handle下的render方法里(Exception $e)用的是use Exception;而我用的是 use think\Exception;
将use think\exception 改为 use Exception,改正后错误小时,以此记录。