Lecture 1: Building a mall project (Lecture 1); Lecture 1: 138th. Lecture 1: Building a mall project (Lecture 1); Lecture 1: example of building a mall framework: file storage directory Image 3: Code Part index. php code 1? Php2 ** 3 Lecture 1: Building a mall project (Lecture 2); Lecture 1: 138th
I. example of mall framework construction
II. file storage directory location images
III. codeIndex. php code
1
Host ."
";
Init. php code
1
Db. class. php
1
AutoExecute ('user', array ('username' => 'zs', 'Email '=> 'zs @ qq.com', 'insert'); 46 is automatically converted: insert into user (username, email) values ('zs', 'zs @ qq.com '); 47 */48 public abstract function autoExecute ($ table, $ data, $ act = 'insert', $ where); 49}
Conf. class. php code
1
Data = $ _ CFG; 17} 18 final protected function _ clone () {19} 20 // Singleton mode 21 public static function getIns () {22 if (self :: $ ins instanceof self) {23 return self: $ ins; 24} else {25 self: $ ins = new self (); 26 return self: $ ins; 27} 28} 29 // read the information in the data attribute by Magic 30 public function _ get ($ key) {31 if (array_key_exists ($ key, $ this-> data) {32 return $ this-> data [$ key]; 33} else {34 return null; 35} 36} 37 // during running, add or change the configuration option 38 public function _ set ($ key, $ value) {39 $ this-> data [$ key] = $ value; 40} 41} 42/* 43 // test code 44 // test whether a singleton mode object can be created 45 $ conf = conf: getIns (); 46 // read option 47 echo $ conf-> host."
"; 48 echo $ conf-> user ."
"; 49 // dynamic append option 50 $ conf-> template_dir =" D: \ LAMP \ Apache2.2 \ htdocs \ boolshop \ include "; 51 echo $ conf-> template_dir; 52 */53 config. inc. php code 54
Workshop (lecture 138th), Lecture 138 1: example of mall framework construction Figure 2: file storage directory location Image 3: Code Part index. php code 1? Php 2/** 3...