weixin_33734785 2010-11-13 20:19 采纳率: 0%
浏览 27

MVC php / ajax问题

I'm developing a php site that displays statistics from an outside site. I drew up this diagram to kind of summarize how the mvc will work. I'm new to implementing the MVC architecture, so could someone tell me if I'm doing this right? I'm thinking that the model is the outside site, and it can't be changed. The controllers are php scripts that parse the data from the site using a screen scraping class. And then the views are php pages that are displayed using ajax. Take a look at this diagram, the squares are views, the circles are controllers, and there is one model. Is this a mvc architecture? http://img641.imageshack.us/img641/8377/mapym.png

  • 写回答

1条回答 默认 最新

  • weixin_33708432 2010-12-22 13:25
    关注

    You can use MVC mostly regardless of framework. If you have separate code for data manipulation, separate code for presentation features and separate code using the first two - you have MVC.

    I implement it in following way: have data objects supporting CRUD and other operations, have presentation objects accepting data objects as input, have REST/AJAX code to handle requests. It could be supported by a framework, but frameworks should not force you to use it. There's probably no way for framework to prevent you from mixing different tasks in one class or file.

    For AJAX MVC seems the most natural. It makes sense to create presentation in JavaScript, while fetching the data using separate PHP module. Everything in between the data and the presentation is a controller.

    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能