如何從下面的對象數組訪問項目陣列PHP如何訪問對象數組
Cart66Cart Object
(
[_items:Cart66Cart:private] => Array
(
[2] => Cart66CartItem Object
(
[_productId:Cart66CartItem:private] => 327
[_quantity:Cart66CartItem:private] => 3
[_optionInfo:Cart66CartItem:private] =>
[_priceDifference:Cart66CartItem:private] => 0
[_customFieldInfo:Cart66CartItem:private] =>
[_productUrl:Cart66CartItem:private] => http://localhost/odesk/cart66/fran-wilson-aloe-lip-care/
[_formEntryIds:Cart66CartItem:private] => Array
(
)
)
[3] => Cart66CartItem Object
(
[_productId:Cart66CartItem:private] => 368
[_quantity:Cart66CartItem:private] => 2
[_optionInfo:Cart66CartItem:private] =>
[_priceDifference:Cart66CartItem:private] => 0
[_customFieldInfo:Cart66CartItem:private] =>
[_productUrl:Cart66CartItem:private] => http://localhost/odesk/cart66/beauty-strokes-basic-shadow-brush/
[_formEntryIds:Cart66CartItem:private] => Array
(
)
)
)
[_promotion:Cart66Cart:private] =>
[_promoStatus:Cart66Cart:private] => 0
[_shippingMethodId:Cart66Cart:private] => 13
[_liveRates:Cart66Cart:private] => Cart66LiveRates Object
(
[toZip] =>
[weight] =>
[rates] => Array
(
)
[_toCountryCode:protected] =>
)
)
是否有可能將公共getItems()函數添加到Cart類中? – gunnx
你是問,*「如何訪問一個私有/受保護的對象屬性?」* - 或 - *「我如何使對象像一個數組一樣行事?」* – rdlowrey
我要求訪問的項目 – nbhatti2001