select()->toArray(); foreach ($field as $v) { unset($where); $where[] = ['name', '=', '量房类型']; $where[] = ['root_id', '=', $v['root_id']]; \app\model\CustomerPortraitField::where($where)->save(['isedit' => 1,'isdel' => 1, 'keyname' => 'state_measuring_room' ,'is_must' => 1]); } } }