okneloper/debug

PHP应用调试工具

dev-master 2018-10-07 15:57 UTC

This package is auto-updated.

Last update: 2024-09-08 07:24:49 UTC


README

将此错误处理器注册到浏览器控制台,以使用FirePHP查看PHP错误。

安装

使用 composer 安装

composer require okneloper/debug

同时安装FirePHP扩展,例如:FirePHP Chrome 扩展

用法

注册FirePHP处理器

\Okneloper\Debug\Debug::registerFirePhpHandler();
echo ${'undefined variable'};

在浏览器控制台中查看PHP提示。

配置

设置根路径

设置应用程序的根路径以排除错误文件路径

$debug = \Okneloper\Debug\Debug::registerFirePhpHandler();
$debug->setRootPath('/home/user/public_html');

之前

Notice: Undefined variable: undefined variable 
in /home/user/public_html/public/index.php on line 25

之后

Notice: Undefined variable: undefined variable 
in public/index.php on line 25