标题示例

问题描述 投票:3回答:1

正文必须至少包含30个字符;您输入了20。

php yii yii2 aop typo3-flow
1个回答
4
投票

我通常使用Logging分析我的代码。

Yii::trace('starting some event');
foreach(..)
{
    ...
}
Yii::trace('some event done');

可以在调试栏的日志部分找到此跟踪。

可以与beforeAction()afterAction()结合使用(未测试)

public function beforeAction($action)
{

    if (!parent::beforeAction($action)) {
        return false;
    }

    Yii::trace($action->id.' started');

    return true; // or false to not run the action
}

public function afterAction($action, $result)
{
    $result = parent::afterAction($action, $result);
    Yii::trace($action->id.' ended');
    return $result;
}

我还在文档中找到了Performance Profiling,但是我没有尝试任何解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.