久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何在 PHP 中從頭實(shí)現(xiàn) MVC?

How to implement MVC from scratch in PHP?(如何在 PHP 中從頭實(shí)現(xiàn) MVC?)
本文介紹了如何在 PHP 中從頭實(shí)現(xiàn) MVC?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我想用 PHP 從頭開(kāi)始??實(shí)現(xiàn) MVC 因?yàn)槲蚁胪耆刂莆易约旱拇a并且沒(méi)有來(lái)自現(xiàn)有框架的額外負(fù)擔(dān).任何人有什么建議嗎?

I would like to implement MVC from scratch in PHP because I want full control of my own code and no extra bagage from existing frameworks. Anyone who has any advice?

是的,我看過(guò) Lerdorfs 的文章,看來(lái)代碼畢竟不多.實(shí)際上,我更希望有一個(gè)控制器視圖解決方案來(lái)構(gòu)建我的應(yīng)用程序.我將堅(jiān)持使用我自己自制的 PDO 數(shù)據(jù)訪問(wèn)類(lèi).

Yes, I've seen Lerdorfs article and it seems that it ain't so much code after all. Actually I would more like to have a controller-view solution for structuring my application. I'll stick to my own homemade PDO data-access classes.

推薦答案

你的問(wèn)題有點(diǎn)像 Not-Invented-這里-綜合癥.在這種情況下,我的建議是,當(dāng)您可以確定現(xiàn)有框架已經(jīng)過(guò)全面測(cè)試和支持時(shí),要忍受它們的額外負(fù)擔(dān).不要重新發(fā)明輪子.

Your question somewhat smells like Not-Invented-Here-Syndrome. In this case, my advice would be to live with the extra baggage of existing frameworks when you can be sure they are thoroughly tested and supported. Don't reinvent the wheel.

另一方面,上述論證會(huì)阻止編寫(xiě)新的框架.從頭開(kāi)始編寫(xiě)一個(gè)是學(xué)習(xí)和理解 MVC 模式的一個(gè)很好的編碼練習(xí).

On the other hand, the above argumentation would prevent new frameworks to be written. And writing one from scratch is a good coding exercise to learn and understand the MVC pattern.

所以如果你真的下定決心去做,我的建議是學(xué)習(xí)MVC的每個(gè)部分是,是,以及它們?nèi)绾蜗嗷プ饔?你也不可避免地會(huì)遇到FrontController 模式,所以你也想了解這個(gè)模式.

So if you are really determined to do it, my suggestion is to learn what each part of MVC is, does and how they interact. You will inevitably come across the FrontController pattern as well, so you will want to learn about this one too.

請(qǐng)注意,您不是唯一想這樣做的人:

Note that you are not the only person wanting to do this:

  • http://www.google.de/search?q=front+控制器+php
  • http://www.google.de/search?q=build+your+own+mvc+php

還有 Rasmus Lerdorf 的這篇有趣的文章

And there is also this interesting article by Rasmus Lerdorf

  • http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html

這篇關(guān)于如何在 PHP 中從頭實(shí)現(xiàn) MVC?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Action View Helper in Zend - Work around?(Zend 中的動(dòng)作視圖助手 - 解決方法?)
Is this a good way to match URI to class/method in PHP for MVC(這是將 URI 與 PHP 中用于 MVC 的類(lèi)/方法匹配的好方法嗎)
Where do I save partial (views) in Zend Framework, to be accessible for all Views in my App?(我在哪里保存 Zend Framework 中的部分(視圖),以便我的應(yīng)用程序中的所有視圖都可以訪問(wèn)?) - IT屋-程序員軟件開(kāi)發(fā)技術(shù)
Having a single entry point to a website. Bad? Good? Non-issue?(有一個(gè)網(wǎng)站的單一入口點(diǎn).壞的?好的?沒(méi)問(wèn)題?)
Is MVC + Service Layer common in zend or PHP?(MVC + 服務(wù)層在 Zend 或 PHP 中常見(jiàn)嗎?)
Hello World example in MVC approach to PHP(PHP MVC 方法中的 Hello World 示例)
主站蜘蛛池模板: 日韩精品一区二区三区 | 精品久| 欧美黄色性生活视频 | 中文字幕乱码一区二区三区 | 亚洲精品久久久9婷婷中文字幕 | 国产在线精品一区二区 | 美女黄网| 欧美激情精品久久久久 | www.youjizz.com日韩 | 精品人伦一区二区三区蜜桃网站 | 久久99久久99久久 | 精品av天堂毛片久久久借种 | 一区二区三区在线 | 国产精品久久久久久久久久久久久久 | 黄色片免费看 | 欧美日韩在线视频一区 | 黄网站在线观看 | 毛片在线免费播放 | 成人精品一区二区户外勾搭野战 | a免费视频 | 丁香婷婷久久久综合精品国产 | 成人av在线大片 | 91精品国产91久久久 | 中文字幕精品视频 | 自拍视频网 | 欧美日韩精品中文字幕 | 成人在线精品视频 | 伦理一区二区 | www.四虎.com | 国产小视频自拍 | 欧洲av在线 | 啪啪免费 | 色综合天天综合网国产成人网 | 亚洲一区二区av | 日本一区二区在线视频 | 亚洲天堂中文字幕 | 国产一区久久精品 | 成年视频在线观看 | 国产日韩久久 | 国产一区二区三区www | 欧美网站一区二区 |