php设计模式 Bridge (桥接模式)
2015-01-24信息快讯网
将抽象部份与它实现部分分离,使用它们都可以有独立的变化
<?php /** * 桥接模式 * * 将抽象部份与它实现部分分离,使用它们都可以有独立的变化 */ abstract class Implementor { abstract public function operation(); } class ConcreteImplementorA extends Implementor { public function operation() { echo "ConcreteImplementorA Operation<br/>"; } } class ConcreteImplementorB extends Implementor { public function operation() { echo "ConcreteImplementorB Operation<br/>"; } } class Abstraction { protected $_implementor = null; public function setImplementor($implementor) { $this->_implementor = $implementor; } public function operation() { $this->_implementor->operation(); } } class RefinedAbstraction extends Abstraction { } class ExampleAbstraction extends Abstraction { } // $objRAbstraction = new RefinedAbstraction(); $objRAbstraction->setImplementor(new ConcreteImplementorB()); $objRAbstraction->operation(); $objRAbstraction->setImplementor(new ConcreteImplementorA()); $objRAbstraction->operation(); $objEAbstraction = new ExampleAbstraction(); $objEAbstraction->setImplementor(new ConcreteImplementorB()); $objEAbstraction->operation();
PHP Warning: PHP Startup: Unable to load dynamic library \ D:/php5/ext/php_mysqli.dll\
PHP中return 和 exit 、break和contiue 区别与用法
PHP字符串函数系列之nl2br(),在字符串中的每个新行 (\n) 之前插入 HTML 换行符br
phpmyadmin安装时提示:Warning: require_once(./libraries/common.inc.php)错误解决办法
php设计模式 State (状态模式)
php设计模式 Chain Of Responsibility (职责链模式)
mac下使用brew配置环境的步骤分享
PHP中break及continue两个流程控制指令区别分析