$value) { //判定$key是否在模型字段中,如果不在则忽略 $fields = Schema::getColumnListing($this->table); if(in_array($key, $fields) && $key != $this->primaryKey) { $this->$key = $value; } } return true; } else { return false; } } }