dsfykqq3403 2016-12-29 16:00
浏览 63
已采纳

Symfony3 - 未定义索引(解码JSON-> Object-> Array)

I create Project Manager Software online, but I have error: picture with data and error

From JavaScript I send data(you can see on the picture), next I get it and decode JSON in result I have stdClass(I try get data for example $data->{"calendarId"}, but I get error: Undefined property: stdClass). Object is converted to array, but again is error. Fragment code:

if($request->isXmlHttpRequest()) {
        $data=json_decode($request->getContent());
        $data=get_object_vars($data);
        echo var_dump($data);
        echo print_r($data);
        //echo $data->{'startTime'} == ERROR Undefined property stdClass
        echo $data["startTime"];
}

I watched many soulation but problem still keep

  • 写回答

1条回答 默认 最新

  • doutan1637 2016-12-29 16:57
    关注

    The error seems very clear: You should use startTask not startTime

    echo $data["startTask"];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 单纯型python实现编译报错
  • ¥15 c++2013读写oracle
  • ¥15 c++ gmssl sm2验签demo
  • ¥15 关于模的完全剩余系(关键词-数学方法)
  • ¥15 有没有人懂这个博图程序怎么写,还要跟SFB连接,真的不会,求帮助
  • ¥15 PVE8.2.7无法成功使用a5000的vGPU,什么原因
  • ¥15 keil官网下载psn序列号在哪
  • ¥15 想用adb命令做一个通话软件,播放录音
  • ¥30 Pytorch深度学习服务器跑不通问题解决?
  • ¥15 部分客户订单定位有误的问题