trait 建立个共用的空间 。当其他类 使用的时候 直接use <?phptrait A { public function show(){ echo '代码复用'; }}class student { use A;}$stu=new student;$stu->show();?>