【问题标题】:Xhprof / xhgui : xhgui - document to insert contains invalid key: keys cannot contain "."Xhprof / xhgui : xhgui - 要插入的文档包含无效键:键不能包含“。”
【发布时间】:2017-09-28 10:00:42
【问题描述】:

我正在尝试使用 Xhprof 设置 Xhgui。 我按照 github 的说明(https://github.com/perftools/xhgui), 但此错误消息不断出现在错误日志中:

"xhgui - 要插入的文档包含无效键:键不能包含 ".": "main()==>加载..."

看起来 mongoDB 不能在键中使用点,但 Xhgui 正在尝试这样做。

有没有办法在 mongoDB 中禁用此限制?或者在 Xhgui 中修复这个错误?

【问题讨论】:

    标签: php mongodb xhprof


    【解决方案1】:

    https://github.com/perftools/xhgui/issues/209#issuecomment-339281276

    对于遇到此问题的任何人,我都能通过 将以下 sn-p 代码添加到 xhgui/external/header.php 就在ignore_user_abort(true)之前;称呼。不知道有多正确 这是否会影响其他任何事情,但它确实起到了作用 我。

        $profile = [];
        foreach($data['profile'] as $key => $value) {
            $profile[strtr($key, ['.' => '_'])] = $value;
        }
        $data['profile'] = $profile;
    

    【讨论】:

    • 谢谢!在我截至 2020 年 1 月使用的版本中,此 sn-p 现在进入文件:xhgui/vendor/perftools/xhgui-collector/external/header.php
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-17
    • 1970-01-01
    • 2011-02-12
    • 2016-12-04
    • 1970-01-01
    • 2016-05-05
    • 1970-01-01
    相关资源
    最近更新 更多