电脑安全

您当前的位置:主页 > 电脑安全 >

用PHP5进行三层开发-网络编程

来源:[db:来源]标题:   逻辑    编辑:电脑技术全能网 时间:2019-09-19 18:28

原标题:用PHP5进行三层开发-网络编程
   此文演示了PHP三层开辟的强盛功效,PEAR::DB_DataObject用于营业逻辑,Smarty用于表现逻辑,这里假定你熟悉了HTML,Smarty,PEAR::DB_DataObject,Mysql和PHP5.假如你须要弥补常识,上面的文章说明了一些道理:用PHP DataObject简化营业逻辑Smarty简介:一个PHP模板引擎PHP可伸缩性:Myth你应当已装置和设置好了Apache,MySQL,和PHP5(或许IIS,MySQL5和PHP)PEAR::DB_DataObjectPEAR::DB_DataObject 是一个用户数据库拜访的形象API.它是一个基于PEAR::DB的SQL构建器和数据建模层.它把数据库表映照到PHP类而且供给像SELECT,INSERT,UPDATE,和DELETE如许的大众SQL函数.这使即便不了解SQL的开辟者也能够写出好的数据库拜访代码,而且鼓舞演示逻辑和营业逻辑有一个清楚的分别.(DB_OO曾经挪动到的PEAR,当初是DB_DataObject,假如你有老的代码要更新,检查对于从老的db_oo代码更新到DB_DataObjects的解释).相干浏览Upgrading to PHP 5By Adam TrachtenbergTable of ContentsIndexSample ChapterRead Online--Safari Search this book on Safari: Only This Book All of SafariCode Fragments only DataObject performs two tasks. First, it builds SQL statements based on the object''s variables and the buildermethods. Second, it acts as a datastore for a table row. There''s a core class, which you extend for each ofyour tables so that you put the data logic inside the data classes. There''s also an included Generator to makeyour configuration files and your base classes.DataObject 履行两个义务.第一,它构建基于工具变量的SQL语句和构建器方式.第二,它作为数据库表的数据存储.这里有个中心类,关于每个表继续它,以使你把数据逻辑放入数据类中.这里还包含一个天生器,DataObject 极大的简化了数据库拜访代码,它使开辟大型的,数据驱动的站点愈加轻易.At present, Alan Knowles, the lead developer of PEAR::DB_DataObject, is working on a new project called DBDO,a C implementation of the PEAR package DB_DataObjects, based on libgda. His goal is to create the nextgeneration of PEAR::DB_DataObjects.SMARTYSmarty是一个从web页演示平分离内容的PHP模板引擎.它应用GPL允许.Large projects commonly separate the role of the graphic designer from that of the programmer. However,programming in PHP has the tendency to combine those two roles in a person and inside the code. This can bringdifficulties when it comes time to change some part of the page''s design. If the page mixes content andpresentation, the developer has to crawl through the program to find the presentation. Smarty helps to solvethis problem.Combining the TwoThe first thing to do when starting this project is

上一篇:php导出CSV方法 (转)-网络编程

下一篇:没有了