时间:2021-07-01 10:21:17 帮助过:16人阅读
二.实例:
message= $event->click();
if ($this->message instanceof process){
$this->message->process();
}
}
}
//播放器的事件处理
class mp4{
public function work(){
$playProcess = new playProcess();
$playProcess->callBack(new event('encode'));
$playProcess->callBack(new event('output'));
}
}
//事件处理类
class event{
private $m;
public function __construct($me){
$this->m = $me;
}
public function click(){
switch($this->m){
case 'encode':
return new playerEncode();
break;
case 'output':
return new playerOutput();
break;
}
}
}
$mp4 = new mp4();
$mp4->work();三.其它:版权声明:本文为博主原创文章,未经博主允许不得转载。
以上就介绍了(七)面向对象的设计原则之三,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。