摘要: 11月10日:最近在看设计模式,争取把23种设计模式都用php写个示例。但是网上php实现的还是比较少,而且就算有例子也不太满意,倒是其他语言写的还不错。于是最近看了很多其他的语言编写的程序,其实都差不多。以后如果有时间,学一下其他面向对象的语言吧,c++甚好。11月12日:终于把23种设计模式过了... 阅读全文
posted @ 2014-11-10 15:04 tai君 阅读(241) 评论(0) 推荐(0) 编辑
摘要: mediator = $mediator; } public function send($message){ $this->mediator->send($message,$this); } abstract function notify($message);}//具体的同事类a b c ... 阅读全文
posted @ 2014-11-10 14:41 tai君 阅读(308) 评论(0) 推荐(0) 编辑
摘要: next_handler = $handler; } abstract public function executeRequest($request);} //具体的处理者,如果能处理,自己处理,不能处理,留给下一个继任者class Leader extends Handler{ public ... 阅读全文
posted @ 2014-11-08 14:43 tai君 阅读(276) 评论(0) 推荐(0) 编辑
摘要: redis这东西,查询起来没有mysql那么方便,只能自己写脚本了。下面是工作中写的两个小脚本第一个脚本,查找有lottery|的键,将他们全部删除|打印出来connect('127.0.0.1'); #连接服务器$m = $redis->keys('lottery|*');print_r($m);... 阅读全文
posted @ 2014-11-06 15:32 tai君 阅读(357) 评论(0) 推荐(0) 编辑
摘要: name = $name; } public function action(){ echo $this->name.'跳大'; } public function action1(){ echo $this->name.'防御'; } public function action2(... 阅读全文
posted @ 2014-11-06 12:07 tai君 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 双十一开发了一个抽奖API,最近上线了,各个事业部的大神们需要前台页面,异步调用我的抽奖API,要我提供js。js 提供之后发现不对,跨域了。之前也碰到过跨域的问题,研究过这个问题,三种方法解决。现在轮到自己解决这个问题了。发现不太好解决。经过一番查看资料啊,调试啊,最后终于调通了。js代码如下fu... 阅读全文
posted @ 2014-11-05 17:25 tai君 阅读(329) 评论(0) 推荐(0) 编辑
摘要: car = $car; $this->speed = $speed; } public function run(){ echo $this->car->run(); echo $this->speed->showSpeed(); echo '行驶在普通街道上'; }}class Free... 阅读全文
posted @ 2014-11-05 10:51 tai君 阅读(465) 评论(0) 推荐(0) 编辑
摘要: aggregate = $aggregate; $this->aggregateCount = $this->aggregate->getCounts(); } public function first(){ $this->index = 0; } public function ne... 阅读全文
posted @ 2014-11-04 16:05 tai君 阅读(210) 评论(0) 推荐(0) 编辑
摘要: name = $name; } public function display(){//树叶只展示自身名字即可 echo $this->name; }}//树枝构件class file extends dir{ public $name; public $items=array(); publi... 阅读全文
posted @ 2014-11-04 12:01 tai君 阅读(341) 评论(0) 推荐(0) 编辑
摘要: state = $state; } public function show(){ echo $this->state.""; } public function setmemento(){//保存至备忘录 return new memento($this->state); } publi... 阅读全文
posted @ 2014-11-03 15:23 tai君 阅读(258) 评论(0) 推荐(0) 编辑