摘要: name = $name; } public function Show() { echo "装扮" . $this->name; }}//服饰类class Finery extends Person{ protected component; public function Decoration(Person $component) { $this->component = $component; } public function Show() { if($this->component != null) { $this->component-& 阅读全文
posted @ 2014-03-14 21:35 好记性还真不如烂笔头 阅读(148) 评论(0) 推荐(0)
摘要: strategy = $strategy; } public function ContextInterface() { $this->strategy->AlgorithmInterface(); }}// 实现过程$context = new Context(new ConcreteStrategyA());$context.ContextInterface();$context = new Context(new ConcreteStrategyB());$context.ContextInterface();$context = new Context(new Concre 阅读全文
posted @ 2014-03-14 21:33 好记性还真不如烂笔头 阅读(328) 评论(0) 推荐(0)
摘要: numA = $numA; $this->numB = $numB; } abstract function getResult();}class OperationAdd extends Operation{ public function getResult() ... 阅读全文
posted @ 2014-03-14 21:32 好记性还真不如烂笔头 阅读(173) 评论(0) 推荐(0)
摘要: 单例类:1、构造函数需要标记为private(访问控制:防止外部代码使用new操作符创建对象),单例类不能在其他类中实例化,只能被其自身实例化;2、拥有一个保存类的实例的静态成员变量3、拥有一个访问这个实例的公共的静态方法(常用getInstance()方法进行实例化单例类,通过instanceo... 阅读全文
posted @ 2014-03-14 21:29 好记性还真不如烂笔头 阅读(156) 评论(0) 推荐(0)
摘要: // bool is_dir(string $filename) 判断给定文件名是否是一个目录。// resource opendir(string $path[,resource $context]) // 打开一个目录句柄,可用于之后的 closedir(),readdir() 和 rewind... 阅读全文
posted @ 2014-03-14 11:08 好记性还真不如烂笔头 阅读(264) 评论(0) 推荐(0)
摘要: function foo($arg){ $arg_num = func_num_args(); // 获取函数参数的个数 $args = func_get_args(); // 获取函数参数列表,以数组形式返回 $arg = func_get_arg(1); // 获取指定的函数参数 print_r($arg);}foo(1, 2);==============================// 寻找与模式匹配的文件路径// glob(partern[, flag])// flag : // GLOB_MARK - 在每个返回的项目中加一个斜线// GLOB_NOSORT - 按照文件在目录 阅读全文
posted @ 2014-03-14 10:00 好记性还真不如烂笔头 阅读(149) 评论(0) 推荐(0)