12 10月
1841

Yii2 如何输出 sql 语句

$model->find()->createCommand()->getRawSql();
$query = Salesorder::find()->where(['order_id'=>[1,2,3,4]])->select(['order_id']);
$commandQuery = clone $query; $commandQuery->createCommand()->getRawSql();