The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

Multiple array in Array

surgutor's Avatar

surgutor

24 Feb, 2017 11:47 AM

Hi guys

I am new in Slim, so I hope you can help me.

I have structure in POST request:

{
"siteID" : "41",
"Room_0":{
"roomID": "62",
"roomName": "Room_1",
},
"Room_1":{
"roomID": "63",
"roomName": "Room_2",
},
"Room_2":{
"roomID": "64",
"roomName": "Room_3",
},
"Room_3":{
"roomID": "65",
"roomName": "WC",
}
}

routes.php file contain code:

$app->post(API_VERSION . API_POINT . '/test', function() use ($app){
$data = json_decode($app->request->getBody(), true);
$app->render('test.php', array(
'siteID' => $data['siteID']
));
});

In test.php file I can use $siteID value and manipulate with it. But how to transmit Room_0[], Room_1[], etc arrays and values inside the arrays? There could be >=0 arrays with "Room_*" name

  1. Josh Lockhart closed this discussion on 12 Feb, 2021 07:37 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac