简体   繁体   中英

Accessing values within arrays and objects

I'm struggling accessing data within Objects and arrays:

对象

I've tried the following;

foreach($orders as $order) {
   echo $orders;
   echo $orders["Order"]
   echo $orders["Order"][0]->OrderId;
   echo $orders["Order"][0];
   echo $orders["Order"]->OrderId;
   echo $orders["Order"]->OrderId;
}

foreach($orders as $key => $value) {
   echo $value;
}

I'm trying to process orders which I can then input into our Magento programmatically.

according to your screenshot it should work this way:

foreach($orders->fields['Order']['value'] as $order){
    $OrderId = $order->fields['OrderId']['value'];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM