我调用函数来获取数组并使用var_dump()
结果是以下数组:
array(1) {
[0]=> array(12) {
["access_id"] => string(1) "1"
["invoice_id"] => NULL
["invoice_public_id"] => NULL
["invoice_payment_id"] => NULL
["invoice_item_id"] => NULL
["user_id"] => string(1) "1"
["product_id"] => string(1) "2"
["transaction_id"] => NULL
["begin_date"] => string(10) "2015-12-24"
["expire_date"] => string(10) "2016-01-24"
["qty"] => string(1) "1"
["comment"] => string(0) ""
}
}
我只需要这部分:
["product_id"]=> string(1) "2"
我怎样才能从数组中获取该部分?
答案 0 :(得分:0)
您可以直接访问该值:
echo $myArray[0]['product_id'];
您可能想要开始阅读有关php中数组的文档: http://php.net/manual/en/language.types.array.php
答案 1 :(得分:-1)
的var_dump($ yourArray [0] [' PRODUCT_ID']);
您不应该将var_dump用于生产,仅用于调试。