Yii2框架查询指定字段和获取添加数据的id

时间:2023-12-15 15:02:20

指定字段:

$historyinfo = Healthy::find()->select(['healthy_id','pet_name','hardware_name','hardware_color','remove_binding'])->where(['user_id'=>$user_id,'is_activation'=>'2'])->asArray()->all();

获取添加数据的id:

 $id = $model->attributes['healthy_id'];
Yii2框架查询指定字段和获取添加数据的id