2 foreach循环,重复结果

时间:2015-02-27 10:52:37

标签: php arrays foreach

基本上是获取列表或订单,然后是与该用户关联的项目列表。

这是我的代码

$collection_array = array();
        $collection_items_array = array();

        foreach($getCollections as $k => $collection){
            $collection_array['CustomerAccountID'] = $collection['collection_account_id'];
            $collection_array['TotalCount'] = $collection['totalCount'];

            // Get order items
            $get_order_items = $Collection->getItems($collection['collection_account_id']);

            foreach($get_order_items as $i => $items){

                $collection_items_array['OrderID'] = $items['order_id'];
                $collection_items_array['OrderItemID'] = $items['item_id'];
                $cia[] = $collection_items_array;
            }

            $collection_array['CollectionItems'] = $cia;
            $ca[] = $collection_array;
        }

但是当我回应它时,它显示结果的所有正确结果,但随后显示秒结果+结果......

0 个答案:

没有答案