Yii2框架查询指定字段和获取添加数据的id
指定字段:
$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'];
如果不行 那就用如下这个