webname=$webname; $this->weburl=$weburl; } function _getwebinfo(){ return "网站名称".$this->webname." ".$this->weburl; }}$hdw=new Web("蓝天","www.lantian.com");echo $hdw->_getwebinfo();*///$this代表当前对象/*class a{ function show(){ $this->d(); } function d(){ echo 1111; }}class b extends a{ function d(){ echo 2222; }}$e=new b();$e->show(); //输出:2222*///self:当前类的引用。/*class a{ function show(){ self::d(); } function d(){ echo 1111; }}class b extends a{ function d(){ echo 2222; }}$e=new b();$e->show(); //输出:1111*///子类没有对应方法时,去找父类的方法/*class e{ function m(){ echo 111; }}class r extends e{}$k=new r();$k->m();//输出:111*///子类有对应的方法时,不找父类的方法了/*class e{ function m(){ echo 111; }}class r extends e{ function m(){ echo 222; }}$k=new r();$k->m();//输出:222*///重写方法的时候,找父类的方法。/*class e{ function m(){ echo 111; }}class r extends e{ function m(){ parent::m(); }}$k=new r();$k->m();//输出:111*/class TPL{ private $tplpath; private $catch; private $catechTime; function __construct() { $this->tplpath="../template/default"; $this->catch="../catch"; $this->catechTime=3600; } function display($tplFile){// echo "载入模板文件:".$tplFile; echo "载入模板文件:{$tplFile}"; echo "========================="; } function reso(){ echo "解析模板标签"; } function wrong(){ echo "...."; }}class APP extends TPL{ function __construct() { parent::__construct(); //拿过来父类的方法。 echo "app";//自己的方法 }}class admin extends APP{}$chanel=new admin();$chanel->display("index.html");class member extends APP{}$user=new member();$user->display('member/user.html');