PHP多维数组访问-五维

PHP多维数组访问-五维,php,arrays,soap,cisco-axl,Php,Arrays,Soap,Cisco Axl,关于我为什么这样做的参考,我尝试使用SOAP/AXL WSDL API。我现在使用的调用者正在以我可以访问的方式构建数组构造 此处提供了API要求以供参考。我面临的挑战是为每个上层数组元素构建成员数组。 数组构造: `$cssnames = array( array("name"=>"US-420-blah Gateway", "description"=>"US-420 Gateway CSS

关于我为什么这样做的参考,我尝试使用SOAP/AXL WSDL API。我现在使用的调用者正在以我可以访问的方式构建数组构造

此处提供了API要求以供参考。我面临的挑战是为每个上层数组元素构建成员数组。

数组构造:

    `$cssnames = array(
                array("name"=>"US-420-blah Gateway",
                        "description"=>"US-420 Gateway CSS",
                        "members"=>array(
                                        array(
                                            "member"=>array(
                                                "Index"=>"1",
                                                "Routeparition"=>"fancyParition"),
                                        array("member"=>array(
                                                "Index"=>"2",
                                                "Routeparition"=>"otherpartition")
                                            )))),
                array("name"=>"US-420-blah Internal Local DN CallFwd",
                        "description"=>"US-420 CSS for Call Forward",
                        "members"=>array(
                                        array(
                                            "member"=>array(
                                                "Index"=>"1",
                                                "Routeparition"=>"fancyParition"),
                                        array("member"=>array(
                                                "Index"=>"2",
                                                "Routeparition"=>"otherpartition")
                                            )))),
                array("name"=>"US-420-blah Internal Local LD DN CallFwd",
                        "description"=>"US-420 for Call Forward LD Allowed",
                        "members"=>array(
                                        array(
                                            "member"=>array(
                                                "Index"=>"1",
                                                "Routeparition"=>"fancyParition"),
                                        array("member"=>array(
                                                "Index"=>"2",
                                                "Routeparition"=>"otherpartition")
                                            )))),
                array("name"=>"US-420-blah Phones Device",
                        "description"=>"US-420 Device CSS",
                        "members"=>array(
                                        array(
                                            "member"=>array(
                                                "Index"=>"1",
                                                "Routeparition"=>"fancyParition"),
                                        array("member"=>array(
                                                "Index"=>"2",
                                                "Routeparition"=>"otherpartition")
                                            )))),
                array("name"=>"US-420-blah Phones Device Internal Only",
                        "description"=>"US-420 Device CSS Internal",
                        "members"=>array(
                                        array(
                                            "member"=>array(
                                                "Index"=>"1",
                                                "Routeparition"=>"fancyParition"),
                                        array("member"=>array(
                                                "Index"=>"2",
                                                "Routeparition"=>"otherpartition")
                                            )))));                          
foreach($cssnames['members'] as $items){
        echo($items['0']['member'] . "</br>");
        }`
更新

所以还有一些进展。我意识到我有一个数组,它只包含一个数组项。太没意义了。一旦我把它去掉,它似乎更有意义。我现在要进行更多的测试。更新代码:

$cssnames = array("css_list"=>
                array("name"=>"US-420-blah Gateway",
                        "description"=>"US-420 Gateway CSS",
                        "members"=>array(
                                        array(
                                                "Index"=>"1",
                                                "Routeparition"=>"fancyParition"),
                                        array(
                                                "Index"=>"2",
                                                "Routeparition"=>"otherpartition")
                                            )));

foreach($cssnames as $level1){
    echo($level1['name'] . "</br>");
    echo($level1['description'] . "</br>");

        foreach ($level1['members'] as $level2){
            echo($level2['Index'] . "</br>");
            echo($level2['Routeparition'] . "</br>");
    }
}
$cssnames=array(“css\u列表”=>
阵列(“名称”=>“US-420-blah网关”,
“说明”=>“US-420网关CSS”,
“成员”=>数组(
排列(
“索引”=>“1”,
“Routeparition”=>“fancyParition”),
排列(
“索引”=>“2”,
“路由描述”=>“其他分区”)
)));
foreach($cssnames为$level1){
echo($level1['name'])。“
”; echo($level1['description'])。“
”; foreach($level1[‘成员’]作为$level2){ echo($level2['Index'])。“
”; echo($level2['Routeparition'])。“
”; } }
最终解决方案是以正确的顺序获取嵌套foreach循环中的项

    foreach($csslist as $level1) {
        $cssname = $level1['name'];
        $cssdescription = $level1['description'];

        foreach($level1['members'] as $level2){ 
            $members[] = array(
                                "index"=>$level2['index'],
                                "routePartitionName"=>$level2['routePartitionName']);
        }
        $programTags[] = array(
                            "name"=>"$cssname",
                            "description"=>"$cssdescription",
                            "members"=>$members);
        //Empty the Members array for the next loop iteration
        $members = array();
    }
    foreach($csslist as $level1) {
        $cssname = $level1['name'];
        $cssdescription = $level1['description'];

        foreach($level1['members'] as $level2){ 
            $members[] = array(
                                "index"=>$level2['index'],
                                "routePartitionName"=>$level2['routePartitionName']);
        }
        $programTags[] = array(
                            "name"=>"$cssname",
                            "description"=>"$cssdescription",
                            "members"=>$members);
        //Empty the Members array for the next loop iteration
        $members = array();
    }