我有一个数组:
Array
(
[47] => Array
(
[name] => 3543 good
[price] => 100.0000
[image] => data/hp_1.jpg
[discount] =>
[stock_status] =>
[weight_class] => kg
)
[28] => Array
(
[name] => HTC Touch HD
[price] => 100.0000
[image] => data/htc_touch_hd_1.jpg
[discount] =>
[stock_status] =>
[weight_class] => g
)
[41] => Array
(
[name] => iMac
[price] => 100.0000
[image] => data/imac_1.jpg
[discount] =>
[stock_status] =>
[weight_class] => kg
)
[40] => Array
(
[name] => iPhone
[price] => 101.0000
[image] => data/iphone_1.jpg
[discount] =>
[stock_status] =>
[weight_class] => kg
)
)
我需要子数组键(47 ,28 等),因为它是我的产品 ID
我正在运行一个 foreach 循环来获取详细信息并分配给一个新数组,例如'name' => $result['name']
,但无法弄清楚如何定位产品 ID。