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,叶面里面的操作也是要有不同逻辑划分的,但是目前没有成熟的应用示例和解决方案。大家有没有自己的尝试?

          文章來源:http://blueoxygen.dflying.net/3/archive/42_lerdorfs_no-framework_php_mvc_framework.html


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


          網(wǎng)站導航:
           

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

          Copyright © BlueO2

          主站蜘蛛池模板: 昆山市| 青神县| 手游| 神池县| 花莲县| 旌德县| 当雄县| 万全县| 锡林浩特市| 隆尧县| 西城区| 留坝县| 永修县| 彰武县| 安龙县| 临沭县| 沁源县| 富锦市| 岱山县| 江都市| 筠连县| 忻州市| 赣榆县| 海南省| 东宁县| 丽江市| 平罗县| 樟树市| 渝北区| 和田市| 嘉峪关市| 印江| 阜城县| 忻州市| 滦南县| 屏东市| 南充市| 霍山县| 阿鲁科尔沁旗| 定州市| 牟定县|