Codeigniter不明索引

时间:2012-11-16 04:02:01

标签: php arrays codeigniter indexing

我有一个函数foo,它返回一个具有以下结构的数组,我想要解决的是有更好的方法来构建我的PHP,因为我不确定foreach中的索引是否正如我想要的那样每ListingId

目标:

我想编写一个foreach循环,从外部XML文档中获取XML <Name>(尚未对此部分进行编码,因为我需要从{{{{}}传递ListingID 1}}进入网址以获取foo

PHP:

<Name>

结构:

    $test0 = $this->foo();
    $test = $test0[0]['ListingId'];

1 个答案:

答案 0 :(得分:1)

尝试这种方式:

foreach($this->foo() as $foo) {
   //here you can use your ListingId
   var_dump($foo['ListingId']);
}
相关问题