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