首页 > php教程 > php手册 > 正文

PHP设计模式汇总

WBOY
发布: 2016-06-21 08:52:57
原创
888 人浏览过

PHP设计模式:

PHP设计模式之装饰器模式

PHP设计模式之委托模式

PHP设计模式之外观模式

PHP设计模式之工厂模式

PHP设计模式之解释器模式

PHP设计模式之迭代器模式

PHP设计模式之中介者模式

如下为数据库脚本:

<ol class="dp-sql">
<li class="alt"><span><span>/*!40101 </span><span class="keyword">SET</span><span> NAMES utf8 */;   </span></span></li>
<li><span>   </span></li>
<li class="alt"><span>/*!40101 <span class="keyword">SET</span><span> SQL_MODE=</span><span class="string">''</span><span>*/;   </span></span></li>
<li><span>   </span></li>
<li class="alt"><span>/*!40014 <span class="keyword">SET</span><span> @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;   </span></span></li>
<li><span>/*!40014 <span class="keyword">SET</span><span> @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;   </span></span></li>
<li class="alt"><span>/*!40101 <span class="keyword">SET</span><span> @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=</span><span class="string">'NO_AUTO_VALUE_ON_ZERO'</span><span> */;   </span></span></li>
<li><span>/*!40111 <span class="keyword">SET</span><span> @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;   </span></span></li>
<li class="alt"><span>/*<span class="keyword">Table</span><span> structure </span><span class="keyword">for</span><span> </span><span class="keyword">table</span><span> `cd` */   </span></span></li>
<li><span>   </span></li>
<li class="alt"><span><span class="keyword">DROP</span><span> </span><span class="keyword">TABLE</span><span> IF EXISTS `CD`;   </span></span></li>
<li><span>   </span></li>
<li class="alt"><span><span class="keyword">CREATE</span><span> </span><span class="keyword">TABLE</span><span> `CD` (   </span></span></li>
<li><span>  `id` <span class="keyword">int</span><span>(8) </span><span class="op">NOT</span><span> </span><span class="op">NULL</span><span> AUTO_INCREMENT,   </span></span></li>
<li class="alt"><span>  `band` <span class="keyword">varchar</span><span>(500) </span><span class="keyword">COLLATE</span><span> latin1_bin </span><span class="op">NOT</span><span> </span><span class="op">NULL</span><span> </span><span class="keyword">DEFAULT</span><span> </span><span class="string">''</span><span>,   </span></span></li>
<li><span>  `title` <span class="keyword">varchar</span><span>(500) </span><span class="keyword">COLLATE</span><span> latin1_bin </span><span class="op">NOT</span><span> </span><span class="op">NULL</span><span> </span><span class="keyword">DEFAULT</span><span> </span><span class="string">''</span><span>,   </span></span></li>
<li class="alt"><span>  <span class="keyword">PRIMARY</span><span> </span><span class="keyword">KEY</span><span> (`id`)   </span></span></li>
<li><span>) ENGINE=InnoDB AUTO_INCREMENT=2 <span class="keyword">DEFAULT</span><span> CHARSET=latin1 </span><span class="keyword">COLLATE</span><span>=latin1_bin;   </span></span></li>
<li class="alt"><span>   </span></li>
<li><span>/*Data <span class="keyword">for</span><span> the </span><span class="keyword">table</span><span> `cd` */   </span></span></li>
<li class="alt"><span>   </span></li>
<li><span><span class="keyword">insert</span><span>  </span><span class="keyword">into</span><span> `CD`(`id`,`band`,`title`) </span><span class="keyword">values</span><span> (1,</span><span class="string">'Never Again'</span><span>,</span><span class="string">'Waster of a Rib'</span><span>);   </span></span></li>
<li class="alt"><span>   </span></li>
<li><span>/*<span class="keyword">Table</span><span> structure </span><span class="keyword">for</span><span> </span><span class="keyword">table</span><span> `tracks` */   </span></span></li>
<li class="alt"><span>   </span></li>
<li><span><span class="keyword">DROP</span><span> </span><span class="keyword">TABLE</span><span> IF EXISTS `tracks`;   </span></span></li>
<li class="alt"><span>   </span></li>
<li><span><span class="keyword">CREATE</span><span> </span><span class="keyword">TABLE</span><span> `tracks` (   </span></span></li>
<li class="alt"><span>  `cid` <span class="keyword">int</span><span>(8) </span><span class="keyword">DEFAULT</span><span> </span><span class="op">NULL</span><span>,   </span></span></li>
<li><span>  `tracknum` <span class="keyword">int</span><span>(8) </span><span class="keyword">DEFAULT</span><span> </span><span class="op">NULL</span><span>,   </span></span></li>
<li class="alt"><span>  `title` <span class="keyword">varchar</span><span>(500) </span><span class="keyword">COLLATE</span><span> latin1_bin </span><span class="op">NOT</span><span> </span><span class="op">NULL</span><span> </span><span class="keyword">DEFAULT</span><span> </span><span class="string">''</span><span>   </span></span></li>
<li><span>) ENGINE=InnoDB <span class="keyword">DEFAULT</span><span> CHARSET=latin1 </span><span class="keyword">COLLATE</span><span>=latin1_bin;   </span></span></li>
<li class="alt"><span>   </span></li>
<li><span>/*Data <span class="keyword">for</span><span> the </span><span class="keyword">table</span><span> `tracks` */   </span></span></li>
<li class="alt"><span>   </span></li>
<li><span><span class="keyword">insert</span><span>  </span><span class="keyword">into</span><span> `tracks`(`cid`,`tracknum`,`title`) </span><span class="keyword">values</span><span> (1,3,</span><span class="string">'What It Means'</span><span>),(1,3,</span><span class="string">'Brr'</span><span>),(1,3,</span><span class="string">'Goodbye'</span><span>);   </span></span></li>
<li class="alt"><span>   </span></li>
<li><span>/*!40101 <span class="keyword">SET</span><span> SQL_MODE=@OLD_SQL_MODE */;   </span></span></li>
<li class="alt"><span>/*!40014 <span class="keyword">SET</span><span> FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;   </span></span></li>
<li><span>/*!40014 <span class="keyword">SET</span><span> UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;   </span></span></li>
<li class="alt"><span>/*!40111 <span class="keyword">SET</span><span> SQL_NOTES=@OLD_SQL_NOTES */;   </span></span></li>
</ol>
登录后复制



相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板