doushenxu7294 2018-02-15 18:28
浏览 65

MVC PHP中的控制器冲突

I am new to PHP. I am developing an application using MVC in PHP. I think I still have some questions roaming around my head about MVC.

In MVC(please correct me if I'm wrong), MODEL will have the data(or gets the data from DB) and VIEW will display it. My MODEL classes read data from the DB and I need to display that data in the VIEW.

My question is, how can I do that?? How can MODEL(which is in PHP) pass the data to the VIEW(which is in HTML) and how can I apply the CSS styles to that data.

For Example : The user searches for a patient, Controller will take the patient_id from the user and passes it to the MODEL, MODEL then, get the details from the DB. now, how can MODEL present these details in a pretty table format in the VIEW?

  • 写回答

1条回答 默认 最新

  • dongshanji3102 2018-02-15 18:36

    I've found this diagram and can't add it in comments, but i hope it will give you a better sense on how MVC works

    enter image description here

    so basically you don't send info from MODEL to VIEW but from MODEL to CONTROLLER and then to VIEW

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 关于#ar#的问题:/* User can add his own implementation to report the HAL error return state */(语言-c语言)
  • ¥15 ImportError: DLL load failed while importing _iterative: 找不到指定的模块。
  • ¥15 如何通过交互分析得出某高危患者对放疗获益更多
  • ¥15 相关性分析中,p<0.05, r=0.29,怎么评价相关性呢
  • ¥15 docker部署Mongodb后输入命令报错?
  • ¥15 将下列流程图转变成python程序代码
  • ¥15 我需要全国每个城市的最新小区名字等数据。
  • ¥15 开发一个小区生态的小程序
  • ¥15 如何解决Excel中dependent dropdown list 的问题
  • ¥15 MddBootstrapInitialize2失败