// 对象转换为数组
function obj2arr($obj){
$result = array();
if(!is_array($obj)){
if($var = get_object_vars($obj)){
foreach($var as $key => $value){
$result[$key] = obj2Arr($value);
}
}
else{
return $obj;
}
}
else{
foreach($obj as $key => $value){
$result[$key] = obj2Arr($value);
}
}
return $result;
}

相关文章:

  • 2021-10-26
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-18
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-09-25
相关资源
相似解决方案