标签(空格分隔): Yii2
标签(空格分隔): Yii2
1 获取 Query 对象
$query = User::find() ->select(['username'])->where(['id'=>[1,2,3,4]) ;
2 克隆对象
$commandQuery = clone $query;
3 输出 sql
echo $commandQuery->createCommand()->getRawSql();
4 输出对象
\yii\helpers\VarDumper::dump( $query->all() );