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 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题