yii2如何输出具体的查询的sql语句:
$query = User::find() ->where(['id'=>[1,2,3,4]) ->select(['username'])
// 输出SQL语句
$commandQuery = clone $query;
echo $commandQuery->createCommand()->getRawSql(); $users = $query->all();
yii2如何输出具体的查询的sql语句:
$query = User::find() ->where(['id'=>[1,2,3,4]) ->select(['username'])
// 输出SQL语句
$commandQuery = clone $query;
echo $commandQuery->createCommand()->getRawSql(); $users = $query->all();