php trait
trait Ahao{ public function Say(){ echo "那指定是不行的"; } } trait HaoD{ public function haoDSay(){ echo "必须的"; } } class TheWorldIsNotEnough { use Ahao; use HaoD; public function sayHello() { echo ‘Hello Universe!‘; } } $o = new TheWorldIsNotEnough(); $o->sayHello(); echo "<br>"; $o->Say(); echo "<br>"; $o->haoDSay(); echo "<br>";