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