$filed); if(!in_array($vale,$arr)) $this->$filed == '' ? $this->$filed =$vale : $this->$filed .=",".$vale; } public function rmField($filed,$vale){ $arr= explode(",",$this->$filed); if(is_array($vale)){ foreach ($vale as $v){ if(in_array($v,$arr)){ $key = array_search($v,$arr); unset($arr[$key]); } } }else{ if(in_array($vale,$arr)){ $key = array_search($vale,$arr); unset($arr[$key]); } } $this->$filed=implode(",",$arr); } public function __destruct(){ $this->save(); } }