yii 打印SQL

  •         echo Location::find()
                ->where(['user_id' => $user_id])
                ->andWhere(['and', ['>', 'location_update_time', $time], ['<', 'location_update_time', $time+86400]])
                ->andWhere(['<>', 'location_name', ''])
                ->groupBy('location_name')
                ->having("count('location_name')>30")
                ->orderBy('location_update_time desc')
                ->limit(50)
                ->createCommand()
                ->getRawSql();
原文地址:https://www.cnblogs.com/bneglect/p/13095684.html