从PHP中的JSON读取值

时间:2016-11-13 20:10:58

标签: php json symfony

如何在PHP中读取JSON中的值?我需要来自mandant的用户名,密码和值 - > name和abbr

感谢

data

1 个答案:

答案 0 :(得分:0)

感谢您的帮助。这是我的解决方案:

   $json = $request->getContent();
   $arrayJson = json_decode($json, true);
   $user = $arrayJson['user'];
   $password = $arrayJson['password'];
   $mandant = $arrayJson['mandant'];
   $mandantName = $mandant('name');
   $mandantAbbr = $mandant('abbr');