查找所有记录
Post::find()->all();
// SELECT * FROM post
或速记
(通过主键或列值数组返回活动记录模型实例。)
Post::findAll(condition);
返回一个 ActiveRecord 实例数组。
查找所有条件
$model = User::find()
->where(['id' => $id])
->andWhere('status = :status', [':status' => $status])
->all();
使用 orderBy 查找全部
$model = User::find()
->orderBy(['id'=>SORT_DESC])
->all();
Or
$model = User::find()
->orderBy(['id'=>SORT_ASC])
->all();