Xhprof / xhgui:xhgui - 要插入的文档包含无效键:键不能包含"。"

时间:2017-09-28 10:00:42

标签: php mongodb xhprof

我试图用Xhprof设置Xhgui。 我按照github说明(https://github.com/perftools/xhgui), 但此错误消息一直出现在错误日志中:

  

" xhgui - 要插入的文件包含无效密钥:密钥不能包含   "。":" main()==>加载......"

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

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

1 个答案:

答案 0 :(得分:1)

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

  

对于遇到此问题的任何人,我都可以使其工作   将以下代码片段添加到xhgui / external / header.php   就在ignore_user_abort之前(true);呼叫。不确定是多么正确   这个,如果它可能会影响其他任何东西,但它的确做到了   我

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