Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.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
Php stdclass对象的回显元素_Php_Stdclass_Surveymonkey - Fatal编程技术网

Php stdclass对象的回显元素

Php stdclass对象的回显元素,php,stdclass,surveymonkey,Php,Stdclass,Surveymonkey,我们正在使用api从特定的基于web的调查站点提取数据,我们需要单独访问以存储在db中,甚至只回显对象中的EmailAddress组件。我们的目标是: object(stdClass)[1] public 'Results' => array (size=1)0 => object(stdClass)[3] public 'EmailAddress' => string 'testemail@t

我们正在使用api从特定的基于web的调查站点提取数据,我们需要单独访问以存储在db中,甚至只回显对象中的EmailAddress组件。我们的目标是:

object(stdClass)[1]
    public 'Results' => 
        array (size=1)0 => 
            object(stdClass)[3]
                public 'EmailAddress' => string 'testemail@test.net' (length=28)
                public 'ListID' => string '947812747189789asf789a7' (length=32)
                public 'ResultsOrderedBy' => string 'email' (length=5)
                public 'OrderDirection' => string 'asc' (length=3)
                public 'PageNumber' => int 1
                public 'PageSize' => int 50
                public 'RecordsOnThisPage' => int 1
                public 'TotalNumberOfRecords' => int 1
                public 'NumberOfPages' => int 1
我们需要做的就是访问/回显EmailAddress元素。在堆栈上发现了类似的问题,但答案似乎不适用于本例:已尝试

echo $result->Results[0]->EmailAddress; 

不走运

谢谢

$result->Results[0]->EmailAddress似乎是可行的

但是试着一件一件地接触它们

var_dump($result);
var_dump($result->Results);
var_dump($result->Results[0]);
var_dump($result->Results[0]->EmailAddress);

首先使用foreach循环结果,然后使用键find email address定义如下内容

foreach ( $result->Results as $key=>$rows ): 
      echo $rows->Email_address; 
endforeach;

得到的错误是什么?PS stdClass是一个对象而不是数组,数组索引由[]访问,而对象属性由->please put echo访问;打印并显示结果
foreach ( $result->Results as $key=>$rows ): 
      echo $rows->Email_address; 
endforeach;