1 function object_array($array){
2 if(is_object($array)){
3 $array = (array)$array;
4 }
5 if(is_array($array)){
6 foreach($array as $key=>$value){
7 $array[$key] = object_array($value);
8 }
9 }
10 return $array;
11 }
12
13 $json = new Services_JSON();
14 $pInfo = $json->decode($strs);//这是一个对象
15 $pArray = object_array($pInfo);//转换为数组
16
17 $userid = $pArray['userid'];//用户标识
18
19 $systype = $pArray['values']['systype'];//系统盘性能
转载于:https://www.cnblogs.com/liruning/p/6023077.html
相关资源:PHP对象转换为数组函数(递归方法)
转载请注明原文地址: https://win8.8miu.com/read-1542030.html