tp5 loader.php报错,TP5自定义全局异常处理是出现错误,解决方法

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;11bfae3263e3563e5e723b6ed0231d42.png

将use think\exception 改为 use Exception,改正后错误小时,以此记录。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值