arrays - How to access json_decode parameters in PHP -


so, i'm trying access input fields in form with

$data = json_encode($app->request->getbody()); 

it returns after echo $data:

"groupname=group13&description=description" 

but can't figure out how access parameters, i've tried with

$data[0] $data['groupname'] $data->groupname 

how can access array elements?


[update] tried of solutions, none of them worked me :( i've solved using since have 2 fields

$groupname = $app->request->post('groupname'); $description = $app->request->post('description'); 

that not json, it's url encoded text... use parse_str() instead.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -