php如何遍历多维的stdClass Object 对象,php的转换成数组的函数只能转换外面一丛数组
(2012-09-10 19:58:49)
标签:
杂谈 |
分类: 网页基础知识 |
function objtoarr($obj){
$ret = array();
foreach($obj as $key =>$value){
if(gettype($value) == ‘array‘ || gettype($value) == ‘object‘){
$ret[$key] = objtoarr($value);
}
else{
$ret[$key] = $value;
}
}
return $ret;
}
时间: 2024-10-05 16:10:31