![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
设计模式
「已注销」
这个作者很懒,什么都没留下…
展开
-
php装饰者模式
装饰者模式动态地将责任附加到对象上,若要扩展功能,装饰者提供了比继承更有弹性的替代方案.example code:# Beverage.php<?phpnamespace Strategy;abstract class Beverage{ public $description = 'Unknown Drink'; public function ge原创 2017-02-22 15:30:15 · 369 阅读 · 0 评论 -
php设计模式_简单工厂2
<?phpclass ChinaPizzaA { public function __construct () { print_r('create ChinaPizzaA instance'); } public function cook () { print_r('cooking ChinaA pizza!'); }原创 2017-07-11 18:28:43 · 304 阅读 · 0 评论 -
php设计模式_简单工厂
<?phpclass PizzaA { public function __construct () { print_r('create PizzaA instance'); } public function cook () { print_r('cooking pizza!'); } public f原创 2017-07-11 17:54:20 · 273 阅读 · 0 评论 -
php设计模式_单例模式
<?phpclass Aaa { private static $me; public static function getInstance () { if (!Aaa::$me) { print_r('single instance'); return new Aaa(); }原创 2017-07-12 11:47:47 · 207 阅读 · 0 评论 -
php设计模式_命令模式
<?phprequire 'Light.php';class LightA extends Light { public function __construct () { print_r("create a lightA "); } public function on () { print_r('lightA is on'原创 2017-07-12 13:58:50 · 283 阅读 · 0 评论