doujiufutaog59220 2009-10-23 13:15
浏览 26
已采纳

PHP中的多步形式 - MVC应用程序

I'm about to program a mutistep form in my MVC App (Self-made MVC framework) in which no data is to be inserted until the last step is finished.

I got the following issues/questions

  • I'd really like to find a kind of pattern to solve this problem, is there any?
  • I want it to be easy the perform a go back action, and get the data back in the last step. Question: Is a session the only way to pass the data? Are get parameter maybe a better/simpler option?
  • How have you solved this problem before
  • 写回答

7条回答 默认 最新

  • dqcd84732 2009-10-23 13:34
    关注

    Look how they implemented it in Symfony, it's quite well built in that framework.

    You just have to download it and look in your project: /lib/symfony/form

    Basically you should create classes for each one of your form inputs;

    • you could always create different and complex ones, then;
    • you go create validator classes for each of them (maybe configurable),
    • you store your data in PHP objects that you save in the session or cookie,

    I would not recommend saving using parameters, too many of them, you have to consider URL max size and browser limits.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么