【问题标题】:How to Have a Detailed Trace of a Slim Application Error如何详细跟踪 Slim 应用程序错误
【发布时间】:2015-12-03 19:47:31
【问题描述】:

我有 10000 行代码概述了使用 Slim 框架实现的 API 的路由。但是,我收到一条错误消息preg_match(): Compilation failed: two named subpatterns have the same name at offset 89。问题是,我在 Slim Route.php 中获得了引用此语句 preg_match('/cost-centers...', '/overview/funds...', NULL) 的堆栈跟踪。现在我的 URL 很长,我无法确定哪些 URL 具有相同的名称。

有什么方法可以得到更详细的堆栈跟踪而不是显示这些缩短的格式?

【问题讨论】:

标签: slim


【解决方案1】:

感谢 mgansler 的提示。

我刚刚使用了 custom error handler 和 PHP Exception::getTrace() 函数。我还关闭了 Slim 的默认调试,以确保调用自定义错误处理程序。

代码如下:

$app = new \Slim\Slim(array(
    'debug' => false
));
$app->error(function (\Exception $e) use ($app) {
    //enter manipulation of $e->getTrace()
    //or just var_dump($e->getTrace()) but the format would be chaotic
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-06
    • 1970-01-01
    • 2017-08-17
    • 1970-01-01
    • 2023-03-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多