相关疑难解决方法(0)

使用ActiveRecord和Yii2记录实际的SQL查询?

我这样做:

$students = Student::find()->all();
    return $this->render('process', array('students' => $students));
Run Code Online (Sandbox Code Playgroud)

然后在视图中:

foreach($students as $student)
    {
        echo $student->name . ',  ';
        echo $student->getQuizActivitiesCount(); ?> <br /> <?php
    }
Run Code Online (Sandbox Code Playgroud)

我想看看正在执行的SQL查询.学生"有很多"测验活动,查询表现完美,但我需要查看原始SQL.这可能吗?

php sql logging activerecord yii2

45
推荐指数
6
解决办法
6万
查看次数

标签 统计

activerecord ×1

logging ×1

php ×1

sql ×1

yii2 ×1