xhprof测试yii2项目,报告中返回“N;”

新手上路,请多包涵

用xhprof测试yii2项目,在xhprof_enable()函数跟xhprof_disable()函数之间利用httpclient请求接口,返回的报告里面只有“N;”导致报告展示页出错,其他任意没有用httpclient的地方报告返回正常,请问我该如何排查错误?

报告为“N;”的代码:

        xhprof_enable(XHPROF_FLAGS_NO_BUILTINS);
        $client = new Client();
        $response = $client->createRequest()
            ->setMethod('get')
            ->setUrl(\Yii::$app->params['api']['cms'] . '/nav/lists')
            ->setData($navdata)
            ->send();

        $xhprof_data = xhprof_disable();
        include_once "../utils/xhprof_lib.php";
        include_once "../utils/xhprof_runs.php";
        $xhprof_runs = new \XHProfRuns_Default();
        $run_id = $xhprof_runs->save_run($xhprof_data, 'dfadf');
        //xhprof_log中的结果为“N;”

报告正常代码:

        function add($a, $b){
            return $a + $b;
        }
        xhprof_enable(XHPROF_FLAGS_NO_BUILTINS);
        add(1, 3);
        $xhprof_data = xhprof_disable();
        include_once "../utils/xhprof_lib.php";
        include_once "../utils/xhprof_runs.php";
        $xhprof_runs = new \XHProfRuns_Default();
        $run_id = $xhprof_runs->save_run($xhprof_data, 'dfadf');
        //xhprof_log中的结果为“a:1:{s:6:"main()";a:2:{s:2:"ct";i:1;s:2:"wt";i:8;}}”
阅读 2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题