Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
stdClass PHP访问数组不工作_Php_Arrays_Soap - Fatal编程技术网

stdClass PHP访问数组不工作

stdClass PHP访问数组不工作,php,arrays,soap,Php,Arrays,Soap,正在尝试访问此数组中的对象。我跟着火车走 无论我尝试什么,我都无法从阵列中获得我所需要的 唯一起作用的是 echo $response->TotalResults; 这给了我18的值。很好,但是当我尝试的时候 echo $response->Call[0]->ToNumber->_; 或 它返回空白 我尝试了另一个帖子中的foreach循环: foreach($responses->TotalResults as $value){

正在尝试访问此数组中的对象。我跟着火车走

无论我尝试什么,我都无法从阵列中获得我所需要的

唯一起作用的是

 echo $response->TotalResults;
这给了我18的值。很好,但是当我尝试的时候

  echo $response->Call[0]->ToNumber->_;

它返回空白

我尝试了另一个帖子中的foreach循环:

    foreach($responses->TotalResults as $value){
       foreach($value->Call as $obj){
         echo $obj->FromNumber;
        }
echo $value->name;
  }
不返回任何内容。我真的没有在php站点上找到任何有助于指导我如何从这种数组中检索数据的东西。下面是数据的示例数组

    object(stdClass)#8 (2) {
   ["TotalResults"]=> int(18)
   ["Call"]=>  array(18) {
        [0]=>
        object(stdClass)#9 (12) {
          ["FromNumber"]=>
          string(11) "17575551211"
          ["ToNumber"]=>
          object(stdClass)#10 (1) {
            ["_"]=>
            string(11) "17575554039"
          }
              ["State"]=>
              string(8) "FINISHED"
              ["BatchId"]=>
              int(33236)
              ["BroadcastId"]=>
              int(1069425001)
              ["ContactId"]=>
              float(836743)
              ["Inbound"]=>
              bool(false)
              ["Created"]=>
              string(20) "2013-08-09T15:24:11Z"
              ["Modified"]=>
              string(20) "2013-08-11T13:16:54Z"
              ["FinalResult"]=>
              string(2) "LA"
              ["id"]=>
              float(1001389)
       ["CallRecord"]=>
              array(2) {
            [0]=>
            object(stdClass)#11 (7) {
              ["Result"]=>
              string(2) "LA"
              ["FinishTime"]=>
              string(20) "2013-08-11T13:16:51Z"
              ["BilledAmount"]=>
              float(1.6667)
              ["QuestionResponse"]=>
              object(stdClass)#12 (2) {
                ["Question"]=>
                string(4) "Q1R1"
                ["Response"]=>
                string(7) "Confirm"
              }
              ["id"]=>
              float(572965)
              ["AnswerTime"]=>
              string(20) "2013-08-11T13:16:22Z"
              ["Duration"]=>
              int(29)
            }
            [1]=>
            object(stdClass)#13 (6) {
              ["Result"]=>
              string(6) "NO_ANS"
              ["FinishTime"]=>
              string(20) "2013-08-11T13:01:05Z"
              ["BilledAmount"]=>
              float(0)
              ["id"]=>
              float(57296503001)
              ["OriginateTime"]=>
              string(20) "2013-08-11T13:00:02Z"
              ["Duration"]=>
              int(0)
    }
  }
}
            [1]=>
            object(stdClass)#14 (12) {
              ["FromNumber"]=>
              string(11) "17575557998"
              ["ToNumber"]=>
              object(stdClass)#15 (1) {
                ["_"]=>
                string(11) "17575557255"
              }
              ["State"]=>
              string(8) "FINISHED"
              ["BatchId"]=>
              int(332369)
              ["BroadcastId"]=>
              int(1069425)
              ["ContactId"]=>
              float(83674367)
              ["Inbound"]=>
              bool(false)
              ["Created"]=>
              string(20) "2013-08-09T15:24:11Z"
              ["Modified"]=>
              string(20) "2013-08-11T13:03:17Z"
              ["FinalResult"]=>
              string(2) "LA"
              ["id"]=>
              float(100138916)
                ["CallRecord"]=>
          object(stdClass)#16 (6) {
            ["Result"]=>
            string(2) "LA"
            ["FinishTime"]=>
            string(20) "2013-08-11T13:03:13Z"
            ["BilledAmount"]=>
            float(5.0001)
            ["id"]=>
            float(57296546)
            ["AnswerTime"]=>
            string(20) "2013-08-11T13:00:35Z"
            ["Duration"]=>
            int(158)
          }
        }
        [2]=>
        object(stdClass)#17 (12) {
          ["FromNumber"]=>
          string(11) "17575557998"
          ["ToNumber"]=>
          object(stdClass)#18 (1) {
            ["_"]=>
            string(11) "17575552158"
          }
          ["State"]=>
          string(8) "FINISHED"
          ["BatchId"]=>
          int(332369)
          ["BroadcastId"]=>
          int(106942)
          ["ContactId"]=>
          float(83674)
          ["Inbound"]=>
          bool(false)
          ["Created"]=>
          string(20) "2013-08-09T15:24:11Z"
          ["Modified"]=>
          string(20) "2013-08-11T13:03:15Z"
          ["FinalResult"]=>
          string(2) "LA"
          ["id"]=>
          float(100138)

             }
          }
       }
关于如何访问阵列的任何帮助都将非常有用。
关于

echo$response->Call[0]->ToNumber->{uu'}
echo$response->Call->CallRecord[0]->结果我尝试了这两种方法,但都不起作用。谢谢你的努力!我必须收回我最后的发言,并说这两个发言是有效的。
    object(stdClass)#8 (2) {
   ["TotalResults"]=> int(18)
   ["Call"]=>  array(18) {
        [0]=>
        object(stdClass)#9 (12) {
          ["FromNumber"]=>
          string(11) "17575551211"
          ["ToNumber"]=>
          object(stdClass)#10 (1) {
            ["_"]=>
            string(11) "17575554039"
          }
              ["State"]=>
              string(8) "FINISHED"
              ["BatchId"]=>
              int(33236)
              ["BroadcastId"]=>
              int(1069425001)
              ["ContactId"]=>
              float(836743)
              ["Inbound"]=>
              bool(false)
              ["Created"]=>
              string(20) "2013-08-09T15:24:11Z"
              ["Modified"]=>
              string(20) "2013-08-11T13:16:54Z"
              ["FinalResult"]=>
              string(2) "LA"
              ["id"]=>
              float(1001389)
       ["CallRecord"]=>
              array(2) {
            [0]=>
            object(stdClass)#11 (7) {
              ["Result"]=>
              string(2) "LA"
              ["FinishTime"]=>
              string(20) "2013-08-11T13:16:51Z"
              ["BilledAmount"]=>
              float(1.6667)
              ["QuestionResponse"]=>
              object(stdClass)#12 (2) {
                ["Question"]=>
                string(4) "Q1R1"
                ["Response"]=>
                string(7) "Confirm"
              }
              ["id"]=>
              float(572965)
              ["AnswerTime"]=>
              string(20) "2013-08-11T13:16:22Z"
              ["Duration"]=>
              int(29)
            }
            [1]=>
            object(stdClass)#13 (6) {
              ["Result"]=>
              string(6) "NO_ANS"
              ["FinishTime"]=>
              string(20) "2013-08-11T13:01:05Z"
              ["BilledAmount"]=>
              float(0)
              ["id"]=>
              float(57296503001)
              ["OriginateTime"]=>
              string(20) "2013-08-11T13:00:02Z"
              ["Duration"]=>
              int(0)
    }
  }
}
            [1]=>
            object(stdClass)#14 (12) {
              ["FromNumber"]=>
              string(11) "17575557998"
              ["ToNumber"]=>
              object(stdClass)#15 (1) {
                ["_"]=>
                string(11) "17575557255"
              }
              ["State"]=>
              string(8) "FINISHED"
              ["BatchId"]=>
              int(332369)
              ["BroadcastId"]=>
              int(1069425)
              ["ContactId"]=>
              float(83674367)
              ["Inbound"]=>
              bool(false)
              ["Created"]=>
              string(20) "2013-08-09T15:24:11Z"
              ["Modified"]=>
              string(20) "2013-08-11T13:03:17Z"
              ["FinalResult"]=>
              string(2) "LA"
              ["id"]=>
              float(100138916)
                ["CallRecord"]=>
          object(stdClass)#16 (6) {
            ["Result"]=>
            string(2) "LA"
            ["FinishTime"]=>
            string(20) "2013-08-11T13:03:13Z"
            ["BilledAmount"]=>
            float(5.0001)
            ["id"]=>
            float(57296546)
            ["AnswerTime"]=>
            string(20) "2013-08-11T13:00:35Z"
            ["Duration"]=>
            int(158)
          }
        }
        [2]=>
        object(stdClass)#17 (12) {
          ["FromNumber"]=>
          string(11) "17575557998"
          ["ToNumber"]=>
          object(stdClass)#18 (1) {
            ["_"]=>
            string(11) "17575552158"
          }
          ["State"]=>
          string(8) "FINISHED"
          ["BatchId"]=>
          int(332369)
          ["BroadcastId"]=>
          int(106942)
          ["ContactId"]=>
          float(83674)
          ["Inbound"]=>
          bool(false)
          ["Created"]=>
          string(20) "2013-08-09T15:24:11Z"
          ["Modified"]=>
          string(20) "2013-08-11T13:03:15Z"
          ["FinalResult"]=>
          string(2) "LA"
          ["id"]=>
          float(100138)

             }
          }
       }