编程语言
首页 > 编程语言> > php用数组解析多维stdclass对象

php用数组解析多维stdclass对象

作者:互联网

我正在使用php访问wsdl webservice.读出效果很好,但解析结果似乎有点困难:我尝试使用var_dump()结果来了解结果如何.这是我用来vardump结果的PHP代码:

 foreach($result as $var => $value) {

  var_dump($value);
    echo "<br />";

}

这就是我得到的:

object(stdClass)#3 (3) {
 ["Successful"]=> bool(true) 
 ["MessageId"]=> string(0) "" 
 ["MlsMessageText"]=> string(0) "" 
 } 

object(stdClass)#4 (3) { 

["RowCount"]=> int(3) 
["ColumnCount"]=> int(3) 
["Columns"]=> object(stdClass)#5 (1) { 

    ["Column"]=> array(3) { 

            [0]=> object(stdClass)#6 (2) { 

                ["Name"]=> string(5) "RowID" 
                ["Rows"]=> object(stdClass)#7 (1) { 

                    ["string"]=> array(3) { 
                    [0]=> string(5) "12001" 
                    [1]=> string(5) "12002" 
                    [2]=> string(5) "12003" } } } 

            [1]=> object(stdClass)#8 (2) { 

                ["Name"]=> string(8) "PersonID" 
                ["Rows"]=> object(stdClass)#9 (1) { 

                    ["string"]=> array(3) { 
                    [0]=> string(11) "12033310001" 
                    [1]=> string(11) "12033310002" 
                    [2]=> string(11) "12033310003" } } } 

            [2]=> object(stdClass)#10 (2) { 

                ["Name"]=> string(10) "PersonName" 
                ["Rows"]=> object(stdClass)#11 (1) { 

                    ["string"]=> array(3) { 
                    [0]=> string(10) "Jack Jones" 
                    [1]=> string(11) "Jenifer Row" 
                    [2]=> string(12) "Marin Banker" } } }

        } 
    } 
} 

它是一个相当复杂的答案,我不知道如何用循环解析它.最后,我想得到一个包含数据的表.

任何帮助非常apreciated

标签:stdclass,php,arrays,parsing,web-services
来源: https://codeday.me/bug/20190901/1783848.html