处理后
处理方法
function object2array_pre(&$object) { if (is_object($object)) { $arr = (array)($object); } else { $arr = &$object; } if (is_array($arr)) { foreach($arr as $varName => $varValue){ $arr[$varName] = $this->object2array($varValue); } } return $arr; } function object2array(&$object) { $object = json_decode( json_encode( $object),true); return $object; }