php 对象转数组
//参考网上 但是别人给的方法有错误的地方
public function eleme_callback(){
$res = (object) array('1' => 'foo');
$data = $this->object_array($res);
}
public function object_array($array) {
if(is_object($array)) {
$array = (array)$array;
}
if(is_array($array)) {
foreach($array as $key=>$value) {
$array[$key] = $value;
}
}
return $array;
}