0

我需要数组的所有键都相同。我知道他们不能用php,但我正在尝试将一个数组发送到soap。

我的数组看起来像这样。

array(     
[0] => Array
    (
        [SKU] => Special Day
        [Description] => Special Day
        [Quantity] => 3
    )

[1] => Array
    (
        [SKU] => The Legend Continues
        [Description] => The Legend Continues
        [Quantity] => 7
    )

[2] => Array
    (
        [SKU] => Blank Inside
        [Description] => Blank Inside
        [Quantity] => 1
    )
)

我需要这个。

$auth = array(

'Shipment' => array(
  'Items' => array( 

      'Item'=> Array
       (
        [SKU] => Special Day
        [Description] => Special Day
        [Quantity] => 3
        )

       'Item' => Array
        (
        [SKU] => The Legend Continues
        [Description] => The Legend Continues
        [Quantity] => 7
        )

      'Item' => Array
       (
        [SKU] => Blank Inside
        [Description] => Blank Inside
        [Quantity] => 1
       )
   )
)

我怎样才能把使数组变成我需要的循环?

我现在正在使用它来制作数组。

while (wpsc_have_cart_items()) : wpsc_the_cart_item(); 
    $items[] = array(
        'SKU' => wpsc_cart_item_name(),
        'Description' => wpsc_cart_item_name(),
        'Quantity' => wpsc_cart_item_quantity()
    );
endwhile;
4

0 回答 0