static functionObject_to_array ($obj) {$class _name = ""; Get class Nameif(Is_object ($obj))
{$class _name = Get_class ($obj);
This key has a class name $obj = (array) $obj; $obj 2 =Array(); Key to remove the class nameforeach($obj as$k => $v) {//echo $class _name);if($class _name) {//echo $k.
Php_eol;
$k = Str_replace ($class _name, "", $k);
Unicode Expression $k = Str_replace ("\u{0000}", "", $k);
echo $k. Php_eol;
} $obj 2[$k] = $v;
Echo $k;
$obj = $obj 2; }Else{$obj = (array) $obj; }foreach($obj as$k => $v) {if(GetType ($v) = = ' Resource ') { return; }if(GetType ($v) = = ' object ' | | GetType ($v) = = ' array ')
{//echo $k; $obj [$k] = (array)Self:: Object_to_array ($V);
Echo $k; }
} return$obj; }
/**
* Array
$arr array
Object *
/array_to_object ($arr) {
(GetType ($arr)!= ' array ') {return;}
$k => $v) {(GetType ($v) = = ' Array ' | | GetType ($v) = = ' object ') {$arr [
$k] = (object) array_to_object ($v);
}
(object) $arr;
}
Results Remove class name Array ([action] => User.gettoken [App_key] => [client_id] => [client_sign] => [Timestamp] => [version] => 1.0 [sign] => [Sign_method] => MD5 [format] => JSON [PLA Tform] => [language] => ZH_CN [data] => Array ([0] => userName [1] = > Rebecca [2] => PassWord [3] => 888) [Auz_app_key] => [auz_sign] =>) did not remove the class name Array ([com\winit\api\model\requestmsgaction] => User.gettoken [com\winit\api\model\r Equestmsgapp_key] => [com\winit\api\model\requestmsgclient_id] => [com\winit\api\model\requestmsgclient_si
GN] => [Com\winit\api\model\requestmsgtimestamp] => [com\winit\api\model\requestmsgversion] => 1.0 [Com\winit\api\model\requestmsgsign] => [Com\winit\api\model\requestmsgsign_method] => MD5 [com\winit\api\m Odel\requestmsgformat] => JSON [com\winit\api\model\requestmsgplatform] => [com\winit\api\model\requestmsglanguage] => Zh_CN
[Com\winit\api\model\requestmsgdata] => Array ([0] => userName [1] => Rebecca
[2] => PassWord [3] => 888) [Com\winit\api\model\requestmsgauz_app_key] =>
[Com\winit\api\model\requestmsgauz_sign] =>)