doujiufutaog59220 2009-10-23 05: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 05: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条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部