作为...我在做什么错?

时间:2019-01-29 16:03:02

标签: php foreach

我正在使用eBay API,为此我需要做foreach

  OrderArray.Order   
 .TransactionArray.Transaction  
 .MultiLegShippingDetails   
 .SellerShipmentToLogisticsProvider  
 .ShipToAddress.AddressID

到目前为止,这是我对TransactionArray的要求

$transactions = $order->TransactionArray;
if($transactions){
    foreach($transactions->Transaction as $transaction){
        echo "Item ID -> " . $transaction->Item->ItemID . "\n";
        $variations = $transaction->Variation;
        echo "Item URL -> " . $variations->VariationViewItemURL . "\n";
        foreach($variations as $variation){
            foreach($variation as $vspecs ){
                foreach($vspecs as $nvl){
                    echo "".$nvl->Name.": ";
                    echo "".$nvl->Value."\n";
                }//foreach vspecs as nvl
            }//foreach variation as vspecs
        }//foreach variations as variation
    }//foreach transactions as transaction
}//if transactions

这是我尝试重建几天前为Variations做的事情,但没有任何运气。

$MultiLegShippingDetails = $transaction->MultiLegShippingDetails;
foreach($MultiLegShippingDetails as $LegShippingDetails){
    $LegShippingDetails->SellerShipmentToLogisticsProvider;
    foreach($LegShippingDetails as $ShipmentToLogisticsProvider){
        $ShipmentToLogisticsProvider->ShipToAddress;
        foreach($ShipmentToLogisticsProvider as $iAddress){
            echo "".$iAddress->ReferenceID."";
        }
    }
}

我在哪里犯错?

0 个答案:

没有答案