zelasli / debugger
处理错误和异常的Zelasli调试器模块。
0.1.0
2023-09-28 14:50 UTC
Requires
- php: >=7.4
README
当开启调试模式时,Zelasli调试器模块用于处理错误和异常并显示错误,否则显示错误信息。
演示
包含所需的类并初始化调试器。
include 'path/to/file/Engine.php' include 'path/to/file/Handler.php' include 'path/to/file/RenderExceptionInterface.php' // First parameter is the debug mode type // Second parameter is the debug environment type (production or development) $debugger = new Engine(true, 'development'); // To start the debugger and handler. $debugger->initialize();
您还可以通过使用 RenderExceptionInterface 来自定义默认处理器的渲染视图。
class PageNotFoundException extends Exception implements RenderExceptionInterface { public function render() { // TODO: implement PageNotFoundException view $view = "<h1>Page not Found (404)<h1>"; return $view; } }