摘要:<?php/** 装饰模式 **/class Person { function __construct($name) { $this->name = $name; } function show() { } function showStyle() { $this->dis .= "$this->name style"; echo $this->dis; }}abstract class Finery { protected $person; public function decorate($per... 阅读全文
posted @ 2012-11-12 22:58 phpzxh 阅读 (231) 评论 (0) 编辑
摘要:<?php/** 简单工厂模式 **/abstract class CDb { abstract function connect(); abstract function query();}class CMysqlDB extends CDb { function connect() { echo 'mysql connect success'; } function query() { echo 'mysql query'; } }class CMssqlDb extends CDb { function connect() { echo 'm 阅读全文
posted @ 2012-11-12 22:57 phpzxh 阅读 (150) 评论 (0) 编辑