随笔分类 - PHP面向对象思想(设计模式)
摘要:PHP命名空间 可以更好地组织代码,与Java中的包类似。 Test1.php <?php namespace Test1;//命名空间Test1 function test(){ echo __FILE__; } Test2.php <?php namespace Test2; //命名空间Tes
阅读全文
摘要:"条记录", 'prev' => "上一页", 'next' => "下一页", 'first'=> "首页", 'last' => "末页" ); //在分页信息中显示内容,可以自己通过set...
阅读全文
摘要:width=$width; $this->height=$height; $this->num=$num; $this->fontsize=$fontsize; $this->pixes=$pixes; $this->lines=$lines; ...
阅读全文
摘要:send=$send; } abstract public function msg($content); public function send($to,$content){ $content=$this->msg($content); $this->send->send($to,$content); ...
阅读全文
摘要:28 ,'wind'=> 7,'sun'=>'sunny'); return serialize($today); } } //增加一个适配器,转换为json格式的数据 class AdapterTianqi extends tianqi{ public static function show(){ ...
阅读全文
摘要:content=$content; } public function decorator(){ return $this->content; } } //摘要 class BianArt extends BaseArt{ public function __construct(BaseArt $art){ $this->art=$ar...
阅读全文
摘要:power){ echo "版主删帖"; }else{ $top=new $this->top; $top->process($lev); } } } class admin{ ...
阅读全文
摘要:观察者模式属于行为模式,是定义对象间的一种一对多的依赖关系,以便当一个对象的状态发生改变时,所有依 赖于它的对象都得到通知并自动刷新。它完美的将观察者对象和被观察者对象分离。可以在独立的对象(主体)中维护一个对主体感兴趣的依赖项(观察器)列表。 让所有观察器各自实现公共的 Observer 接口,以
阅读全文
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>面向对象之观察者模式</title> </head> <style type="text/css"> .word{ width:500px; height: 1
阅读全文
摘要:1 _db; 19 } 20 } 21 ////使用单例模式后不能直接new对象,必须调用getInstance获取 22 $conn1=Dbconn::getInstance(); 23 $_db=$conn1->connect(); 24 //第二次调用是同一个实例,_counter还是1 25 $conn2=Dbconn::getInstance(); 26 $_...
阅读全文


浙公网安备 33010602011771号