$this

if($this->rights=="none"){
$publicsfields=array("CabinetID","DataCenterID",'Location','LocationSortable','ZoneID');
//$this as $prop=>$value 对象的属性可以向数组一样进行操作,
foreach($this as $prop=>$value){
if(!in_array($prop,$publicfields)){
$this->$prop=null;
}
}
}

foreach($cabinetList as $i => $cab){
if($limit && ($cab->MapX1==$cab->MapX2 || $cab->MapY1==$cab->MapY2)){
//注销数组元素
unset($cabinetList[$i]);
}
}
 
原文地址:https://www.cnblogs.com/hehexu/p/8570624.html