发布于 1970-01-01 08:00
  • 1 个回答
    • 首先创建需要的Model, 增加'将要保存有表单提交过来的值的'属性和对应的验证规则/场景.
      加载Model到视图中, 在创建每个表单项时指定属性对应的Model, 如:$form->field($marketModel, 'market')->textinput();
      提交表单, 然后参考下面的步骤 进行加载, 验证, 保存.

      参考官方文档给出的步骤
      1. instantiate model classes
      2. populate the models attributes with input data
      3. validate all models
      4. If validation passes for all models, save them
      5. If validation fails or no data has been submitted, display the form
      by passing all model instances to the view

      2022-12-01 18:31 回答
    撰写答案
    今天,你开发时遇到什么问题呢?
    立即提问
    PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
    Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有