我有这个数组
$oc_product = array(
array('product_id' => '93','model' => '333222','sku' => '2222','upc' => '','ean' => '','jan' => '','isbn' => '','mpn' => '','location' => '','quantity' => '1000','stock_status_id' => '5','image' => 'data/product/main/x.jpg','manufacturer_id' => '55','shipping' => '1','price' => '1128.0000','points' => '0','tax_class_id' => '9','date_available' => '2013-09-07','weight' => '0.00000000','weight_class_id' => '2','length' => '0.00000000','width' => '0.00000000','height' => '0.00000000','length_class_id' => '2','subtract' => '0','minimum' => '1','sort_order' => '0','status' => '1','date_added' => '2013-03-16 03:37:07','date_modified' => '2013-12-09 10:40:58','viewed' => '2938'),
array('product_id' => '94','model' => '333133','sku' => '2222','upc' => '','ean' => '','jan' => '','isbn' => '','mpn' => '','location' => '','quantity' => '1000','stock_status_id' => '5','image' => 'data/product/main/y.jpg','manufacturer_id' => '0','shipping' => '1','price' => '2048.0000','points' => '0','tax_class_id' => '9','date_available' => '2013-09-07','weight' => '0.00000000','weight_class_id' => '2','length' => '0.00000000','width' => '0.00000000','height' => '0.00000000','length_class_id' => '2','subtract' => '0','minimum' => '1','sort_order' => '0','status' => '1','date_added' => '2013-03-29 13:27:20','date_modified' => '2013-10-29 22:55:22','viewed' => '1704'),
array('product_id' => '95','model' => '111222','sku' => '2222','upc' => '','ean' => '','jan' => '','isbn' => '','mpn' => '','location' => '','quantity' => '500','stock_status_id' => '5','image' => 'data/product/main/z.jpg','manufacturer_id' => '0','shipping' => '1','price' => '1279.2000','points' => '0','tax_class_id' => '9','date_available' => '2013-09-07','weight' => '0.00000000','weight_class_id' => '2','length' => '0.00000000','width' => '0.00000000','height' => '0.00000000','length_class_id' => '2','subtract' => '0','minimum' => '1','sort_order' => '0','status' => '1','date_added' => '2013-03-29 15:31:40','date_modified' => '2013-10-29 22:52:43','viewed' => '2063')
);
我需要显示所有ID和数量的文章,如:
ID: 93, Quantity: 1000
ID: 94, Quantity: 1000
ID: 95, Quantity: 500
答案 0 :(得分:0)
foreach($oc_product as $p){
echo 'ID: '.$p['product_id'].', Quantity: '.$p['quantity'].'<br>';
}