When I use var_dump($_POST)
, I get this:
array(2) {
["param"]=>
string(327) "{"username":"asd","password":"asdasd","language":"7"}"
}
I need to get username
. I've tried it this:
$arr = json_decode($_POST['param'], true);
echo $arr["username"];
But it doesn't work.
Anyone know where my error is and what the right way to get element username
is?
Please check the edited answer:
$arr = json_decode($_POST['param'],true);
echo $arr['username'];
Your jason encoded string seems to be inside the param
element, Try this:
$arr = json_decode($par['param'], true);
echo $arr["username"];