1、Yii2获取当前程序执行的sql语句:
$query = model::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pagesize' => '25',
]
]);
//获取当前程序执行的sql语句
$query->createCommand()->getRawSql();