Rasmus Lerdorf, creator of the PHP langauge, has a new tutorial on his site today that looks at the creation of a "no-framework PHP MVC framework" using PHP5, the Yahoo! User Interface Library, and JSON.

          He steps through the entire process of working up the "non-framework" - the goals of the project, why to go with the MVC approach for the structure, and, of course, the code.

          That arose the PHP's own MVC Pattern discussion in PHP Community.But i have my own view.Here is my response in one of most famous PHP community:


          其实我认为由于lerdorf演示的是一个PHP AJAX应用,所以其实很难跟cid的方案有什么对比。由于AJAX应用的特殊性,lerdorf这个所谓的controller根本不需要考虑进行完了相关的操作以后View到底应该去哪里,应该转向哪里?因为直接push给客户端JSON对象就好了,完全不用操心到a.php还是b.php
          另外,虽然lerdorf说以后可能可以多个请求Include一个xxx.inc就是他的controller,但是目前的状况,即使成为MVC也是page controller,而cid想要做的是一个Front controller做请求委派,Front Controller的复杂的明显要比PC要高,考虑的问题也多。但是并不是说FC就好,asp.net不就是典型的page controller模式么?
          但是说句我的真实感受:读完之后我把它看作PHP AJAX应用示例教程更合适,lerdorf的标题起的有点大了,而且读完以后没有给我任何架构上启示性的东西??
          而且那个if(isset($_POST[''])){}在里面做相关操作,我还是认为挺简陋甚至丑陋的。如果一个挺复杂的view采用此种方式,还是不优雅。
          所以AJAX应用的controller有一部分应该放在View里面,一个页面a.html不一定非要请求到a.php,叶面里面的操作也是要有不同逻辑划分的,但是目前没有成熟的应用示例和解决方案。大家有没有自己的尝试?

          文章來(lái)源:http://blueoxygen.dflying.net/3/archive/42_lerdorfs_no-framework_php_mvc_framework.html


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           

          posts - 29, comments - 3, trackbacks - 0, articles - 0

          Copyright © BlueO2

          主站蜘蛛池模板: 岑溪市| 高雄市| 星座| 遂川县| 新源县| 视频| 新沂市| 景德镇市| 东平县| 深圳市| 扶余县| 图木舒克市| 蒙城县| 宜兰市| 同江市| 麻阳| 浦城县| 岳普湖县| 莱阳市| 贡嘎县| 康平县| 峡江县| 荆门市| 黔江区| 延川县| 银川市| 苏州市| 安庆市| 汤阴县| 渑池县| 新郑市| 奉化市| 扎赉特旗| 和平区| 温宿县| 汨罗市| 饶河县| 彭阳县| 博罗县| 寿阳县| 刚察县|