您好,欢迎访问一九零五行业门户网

php中的设计模式之策略模式

strategy = $strategy; } // 开始策略 public function startstrategy(){ $this->strategy->handle(); } }$people = 'teacher';switch($people){ case 'student' : $strategy = new studentstrategy () ;break; case 'teacher' : $strategy = new teacherstrategy () ;break;}$safepeople = new testcheck();$safepeople ->setstrategy($strategy);$safepeople ->startstrategy();
其它类似信息

推荐信息