PHP in 2004

xiaoxiao2021-03-06  14

The development model of PHP is basically formed. It will not deliberately study his related technique in the future, so I will write a bit of PHP development. Chapter 1 Chapter 1 PHP directory tree Download ourselves PEAR package Put him in a PHP installation directory (D: / PHP / PEAR). PEAR directory tree can refer to cvs.php.net. The most basic is: /pear.php ,/pear ,/db.php ,///// DB, / System.php, / config.php, / config, / http / upload.php Commonly used packages here. For example, Smarty, AdoDB, etc., you can also store your own class functions, such as the class.pager.php. After the file is put, edit the php.ini file, modify include_path parameter. Change it to.; D: / PHP / PEAR; D: / PHP / LIB. Directory tree settings are completed. Chapter II Application Directory Of course, you can completely refer to the PHPMVC's directory structure, set the directory of the JSP structure of Web-Info. My directory tree is as follows: /lib/lib/classes/lib/functions/lib/lang/inc/inc/inc.config.php/inc/config.xml/Images/uploads/admin/admin/fckeditor_2.0rc1/admin / Images in the directory lib / classes Class files, such as class.news.php. Directory lib / functions is stored in the code segment, write it into function to prevent it here. /inc/inc.config.php is used to resolve config.xml and create a database connection.

/ Inc/config.xml lists some information about the application, such as the third chapter of the application, such as database username and password, etc. Example 1, config.xml http://www.lhb.cn < /HostName> (Hostf> (0>bb_ )/Charset d d d 2 ot d d nt D: / phpsite / XYCW http: // localhost / XYCW / D: / phpsite / XYCW / lib < / include_path> false false image / gif image / jpeg image / pjpeg Application / X-ShockWave-Flash hb_lv@hotmail.com 57893609

2.inc.config.php parseconfig ($ Filesrc, 'XML'); $ config = $ root-> getItem ('section', 'config'); $ confarr = $ config-> toArray ();?> <$ sys_include_path = INI_GET ('incdude_path'); $ include_path = $ sys_include_path. ";". $ confArr [config] [include_path]; ini_set ( "include_path", $ include_path);?> <$ database_conn = $ confArr [config] [database_conn];? $ database_user = $ confArr [config] [database_user]; $ database_pwd = $ confArr [config] [database_pwd]; $ database_name = $ confArr [config] [database_name]; // mysqlConn // $ conn = mysql_pconnect ($ database_conn, $ database_user, $ database_pwd) or die (mysql_error ()); // mysql_select_db ($ database_name); // adodbConninclude ( 'adodb423 / adodb.inc.php'); $ adodbConn = & ADONewConnection ( 'mysql'); $ adodbConn-> debug = false; $ adodbConn-> PConnect ($ database_conn, $ database_user, $ database_pwd, $ database_name);??> 3, site.php (modified config.xml) compile _Check = true; $ smarty-> debugging = false; $ smarty-> left_delimiter = "<{"; $ smarty-> right_delimiter = "}>"; $ OPERATION = (isset ($ _ get ['op'])? $ _GET ['op']: $ _ post ['op']; switch ($ OPERATION) {case "updatesiteInfoAction": updatesiteInfo (): UpdatesiteInfo (); break; default: getsiteInfo (); break;} # function getsiteInfo () {Global $ Smarty; $ filesrc = "config.xml"; $ c = new config (); $ root = & $ c-> parseconfig ($ filesrc, 'xml'); $ config = $ root->

转载请注明原文地址:https://www.9cbs.com/read-67596.html

New Post(0)