{
"VM_set_PV_args":"",
"VM_set_PV_bootloader":"eliod",
"VM_set_other_config":{
"install-repository":"http:\/\/mirror.yandex.ru\/debian\/",
"install-distro":"debianlike",
"debian-release":"trusty",
"install-arch":"i386"
}
}
foreach($params as $param){
if(!массив($param)){
$xe->$param[key]($param[value]); # необходимо получить $xe->VM_set_PV_bootloader("eliod")
}else{
foreach($param as $par){
$xe->$param($par[key],$par[value]) # необходимо чтобы получилост $xe=>VM_set_other_config("install-repository","http:\/\/mirror.yandex.ru\/debian\/") и далее по всему массиву VM_set_other_config
}
}}
$json = '{
"VM_set_PV_args":"",
"VM_set_PV_bootloader":"eliod",
"VM_set_other_config":{
"install-repository":"http:\/\/mirror.yandex.ru\/debian\/",
"install-distro":"debianlike",
"debian-release":"trusty",
"install-arch":"i386"
}
}';
$arr = json_decode($json, true);
echo $arr['VM_set_PV_bootloader'];
foreach ($arr['VM_set_other_config'] as $key => $val) {
echo $val;
}
function handleArrayRecursive(array $model) {
foreach($model as $item) {
if (is_array($item)) {
hadleArrayRecursive($item);
} else {
//...do something
}
}
}
hadleArrayRecursive(json_decode($json, true));