This commit is contained in:
CHIEFSOFT\ameye
2023-11-26 18:33:00 -05:00
parent dde6e588e9
commit 21d339daaf
+12 -1
View File
@@ -80,7 +80,7 @@ class Bko extends BaseController
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$in = flatten(json_decode(file_get_contents('php://input'), true));
$in = $this->flatten(json_decode(file_get_contents('php://input'), true));
}
if ($_SERVER["REQUEST_METHOD"] == "PUT") {
parse_str(file_get_contents('php://input'), $in);
@@ -113,4 +113,15 @@ class Bko extends BaseController
echo json_encode(( new ResultFormatter() )->processOutJson($in, $out));
exit();
}
function flatten($data, $parentkey = "") {
$result = array();
foreach ($data as $key => $val) {
if (is_array($val)) {
$result = array_merge($result, flatten($val, $parentkey . $key . "_"));
} else {
$result[$parentkey . $key] = $val;
}
}
return $result;
}
}