报错信息:
Fatal error: Uncaught exception 'think\exception\ErrorException' with message 'Argument 1 passed to app\lib\exception\ExceptionHandler::render() must be an instance of think\Exception, instance of think\exception\RouteNotFoundException given, called in F:\Develop\Project\wxshop\zerg\thinkphp\library\think\Error.php on line 56 and defined' in F:\Develop\Project\wxshop\zerg\application\lib\exception\ExceptionHandler.php on line 27
解决方式:
代码里20行,也就是public function render(\Exception $e){}
需要在Exception
前加一个\
问题原因:
RouteNotFoundException
和ErrorException
都继承于基类Exception
这里判断不出来我们重写的到底继承哪一个,所以直接定义成根路径的基类\Exception
正确写法:
<?php
namespace app\lib\exception;
use think\Exception;
use