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 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办