随笔分类 -  设计模式

摘要:<?php header("Content-type:text/html;charset=utf-8"); abstract class msg{ protected $send = null; public function __construct($send){ $this->send = $s 阅读全文
posted @ 2020-01-12 17:31 A毛毛 阅读(169) 评论(0) 推荐(0) 编辑
摘要:<?php header("Content-type:text/html;charset=utf-8"); // 适配器模式 /** * 查看天气接口 */ class Tianqi { public static function show(){ $arr = array('tem'=>28,'w 阅读全文
posted @ 2020-01-12 16:26 A毛毛 阅读(187) 评论(0) 推荐(0) 编辑
摘要:<?php header("Content-type:text/html;charset=utf-8"); /** * 文章编辑类 */ class Article { protected $content; protected $art = null; public function __cons 阅读全文
posted @ 2020-01-12 16:01 A毛毛 阅读(145) 评论(0) 推荐(0) 编辑
摘要:html <html> <head> <meta charset="UTF-8"> <title>简单计算器</title> </head> <body> <h1>简单计算器</h1> <form action="10.php" method="post"> <input type="text" n 阅读全文
posted @ 2020-01-12 12:46 A毛毛 阅读(214) 评论(0) 推荐(0) 编辑
摘要:html <html> <head> <meta charset="UTF-8"> <title>责任链模式</title> </head> <body> <h1>责任链模式举报</h1> <form action="09-2.php" method="post"> <select name="le 阅读全文
posted @ 2020-01-12 12:17 A毛毛 阅读(229) 评论(0) 推荐(0) 编辑
摘要:html <html> <head> <meta charset="UTF-8"> <title>责任链模式</title> </head> <body> <h1>责任链模式举报</h1> <form action="09.php" method="post"> <select name="lev" 阅读全文
posted @ 2020-01-12 11:56 A毛毛 阅读(417) 评论(0) 推荐(0) 编辑
摘要:php提供的两个接口,一个被观察者接口SplSubject,一个或多个观察者接口SPLObserver,和一个可以储存对象的类SplObjectStorage。被观察者有三个方法,需要实现这三个方法,一个attach可以理解为添加一个观察者,detach可以理解为删除掉一个观察者,一个notify里 阅读全文
posted @ 2020-01-12 11:30 A毛毛 阅读(469) 评论(0) 推荐(0) 编辑
摘要:前端界面 html代码 <body> <select name="" id="select"> <option value="">请选择风格</option> <option value="male">男式风格</option> <option value="female">女士风格</option 阅读全文
posted @ 2020-01-12 10:07 A毛毛 阅读(450) 评论(0) 推荐(0) 编辑
摘要:<?php header("Content-type:text/html;charset=utf-8"); /** * 第一步,分别实例化 */ /*class Single { function __construct() { # code... } } $s1 = new Single(); $ 阅读全文
posted @ 2020-01-11 22:20 A毛毛 阅读(189) 评论(0) 推荐(0) 编辑
摘要:实现不修改原代码,扩展新功能 <?php header("Content-type:text/html;charset=utf-8"); /** * db接口 * 实现连接数据库函数conn */ interface db { function conn(); } /** * 工厂接口 * 实现创建 阅读全文
posted @ 2020-01-11 21:07 A毛毛 阅读(149) 评论(0) 推荐(0) 编辑
摘要:<?php header("Content-type:text/html;charset=utf-8"); /** * 共同接口 */ interface db { function conn(); } /** * mysql类 */ class DbMysql implements db { pu 阅读全文
posted @ 2020-01-11 20:37 A毛毛 阅读(270) 评论(0) 推荐(0) 编辑
摘要:<?php header("Content-type:text/html;charset=utf-8"); /** * 共同接口 */ interface db { function conn(); } /** * mysql类 */ class DbMysql implements db { pu 阅读全文
posted @ 2020-01-11 20:22 A毛毛 阅读(374) 评论(0) 推荐(0) 编辑
摘要:<?php header("Content-type:text/html;charset=utf-8"); /** * 虎 */ abstract class Tiger { public abstract function climb(); } /** * x虎 */ class Xtiger e 阅读全文
posted @ 2020-01-11 19:59 A毛毛 阅读(176) 评论(0) 推荐(0) 编辑