<?php
class object_array{
//数组转对象
public static function array_to_object($e){
if(gettype($e)!='array') return;
foreach($e as $k=>$v){
if(gettype($v)=='array' || getType($v)=='object')
$e[$k]=self::arrayToObject($v);
}
return (object)$e;
}
//对象转数组
public static function obj_to_array($e){
$e=(array)$e;
foreach($e as $k=>$v){
if(gettype($v)=='resource') return;
if(gettype($v)=='object' || gettype($v)=='array')
$e[$k]=self:: get_array($v);
}
return $e;
}
}
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询