$form->hasMany('attachments', '附件', function (Form\NestedForm $nestedForm) { $nestedForm->text('name','附件名称'); $nestedForm->file('local_path','附件') //设置class选择器不重复即可 ->setElementClass(md5(microtime(true))) ->uniqueName() ->removable(); });