Yii2获取当前程序执行的sql语句

$query = model::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'pagesize' => '25',
            ]
        ]);

//获取当前程序执行的sql语句
$query->createCommand()->getRawSql();

你可能感兴趣的:(php,yii)