//将对象转换为数组
function objectToArray($object) { $object = (array)$object; foreach ($object as $key => $value) { if (is_object($value)) { objectToArray($value); $object[$key] = $value; } if (is_array($value)) { objectToArray($value); $object[$key] = $value; } } return $object; }