![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
设计模式
程序 设计模式
Yj炎翼
我们追求完美!
展开
-
简单工厂
<?php/** * 简单工厂模式 * 由鼠标工厂来决定具体生产那种鼠标 * *///鼠标类interface Mouse{ //制作鼠标 public function make();}//戴尔鼠标class DellMouse implements Mouse{ public function make() { ...原创 2019-09-11 15:10:41 · 60 阅读 · 0 评论 -
工厂模式
<?php/** * 工厂模式 *///鼠标类interface Mouse { public function make();}class HpMouse implements Mouse{ public function make() { echo "Hp Mouse \n"; }}class DellMous...原创 2019-09-11 16:46:46 · 75 阅读 · 0 评论 -
抽象工厂
<?php/** * 抽象工厂模式 *//************************ 鼠标 *************************/interface Mouse{ public function make();}//戴尔鼠标class DellMouse implements Mouse{ public function mak...原创 2019-09-11 16:48:03 · 72 阅读 · 0 评论 -
单例模式
<?php/** * 单例模式 */class Config{ private static $instance; private function __construct() { //禁止实例 } public static function init() { if(!self::$insta...原创 2019-09-11 16:56:26 · 79 阅读 · 0 评论 -
对象池模式
<?php/** * 对象池模式 *//** * MySQL 对象 * Class Mysql */class Mysql{ private $createAt; public function __construct() { //sleep(1); $this->createAt = date("Y-m...原创 2019-09-16 11:08:20 · 86 阅读 · 0 评论