<?php
/**
*object->array
*
**/
function object2array(&$cgi,$type=0) {
if(is_object($cgi)) {
$cgi = get_object_vars($cgi);
}
if(!is_array($cgi)) {
$cgi = array();
}
foreach($cgi as $kk=>$vv) {
if(is_object($vv)) {
$cgi[$kk] = get_object_vars($vv);
object2array($cgi[$kk],$type);
//utf8_gbk($vv);
}
else if(is_array($vv)) {
object2array($cgi[$kk],$type);
} else {
$v = $vv;
$k = $kk;
$cgi["$k"] = $v;
}
}
return $cgi;
}
php 函数 object to array
最新推荐文章于 2023-07-27 19:40:39 发布