online_time); $int=time()-$value; if($int>300){ return '0'; }else{ return '1'; } } public function getOnlineTimeAttr($value){ if($value){ return $value; } return '-'; } public function getIsOnlineTextAttr($value){ $value = strtotime($this->online_time); $int=time()-$value; if($int>300){ return '离线'; }else{ return '在线'; } } }