{ if (in_array($arr, $this->arr)) { return true; } $this->arr[] = $arr; } public function remove($arr) { $this->arr = array_diff($this->arr, array($arr)); } } $team = new team(); $team->add('c'); $team->add('b'); $team->add('a'); $team->remove('b'); //var_dump($team->arr); //装饰者 abstract class Beverage { public $_name; public abstract function cost(); } //被装饰者 class Coffee extends Beverage { public function __construct() { $this->_name = 'Coffee'; } public function cost()