我有一個將值賦給對象#?
stdClass Object ([cart_item_id] => 319299
[cart_id] => 1
[nid] => 2140
[qty] => 15
[changed] => 1319485739
[data] => Array (
[gift_description] => ghgfdhfghfh
[gift_email] => [email protected]
[gift_sender] => gfdhgfdhgfdhgf
[gift_sendDate] => 2011-10-24
[gift_title] => gfdgfdgdf
[gift_card] => 2130
[gift_price] => $26
[module] => uc_product
)
[title] => Gift Card
[vid] => 2140
[cost] => 0
[price] => 1
[weight] => 0
[module] => uc_product
[model] => giftcard
) stdClass Object ([cart_item_id] => 319299
[cart_id] => 1
[nid] => 2140
[qty] => 15
[changed] => 1319485739
[data] => Array (
[gift_description] => ghgfdhfghfh
[gift_email] => [email protected]
[gift_sender] => gfdhgfdhgfdhgf
[gift_sendDate] => 2011-10-24
[gift_title] => gfdgfdgdf
[gift_card] => 2130
[gift_price] => $26
[module] => uc_product
)
[title] => Gift Card
[vid] => 2140
[cost] => 0
[price] => 1
[weight] => 0
[module] => uc_product
[model] => giftcard
) ... etc
現在我想要做的就是通過這些組中的每一個循環(的foreach爲例),並採取了價格數據和標題,並將其分配給價格和標題。所以我會結束。
stdClass Object ([cart_item_id] => 319299
[cart_id] => 1
[nid] => 2140
[qty] => 15
[changed] => 1319485739
[data] => Array (
[gift_description] => ghgfdhfghfh
[gift_email] => [email protected]
[gift_sender] => gfdhgfdhgfdhgf
[gift_sendDate] => 2011-10-24
[gift_title] => gfdgfdgdf
[gift_card] => 2130
[gift_price] => $26
[module] => uc_product
)
[title] => Gift Card
[vid] => 2140
[cost] => 0
[price] => 1
[weight] => 0
[module] => uc_product
[model] => giftcard
) stdClass Object ([cart_item_id] => 319299
[cart_id] => 1
[nid] => 2140
[qty] => 15
[changed] => 1319485739
[data] => Array (
[gift_description] => ghgfdhfghfh
[gift_email] => [email protected]
[gift_sender] => gfdhgfdhgfdhgf
[gift_sendDate] => 2011-10-24
[gift_title] => gfdgfdgdf
[gift_card] => 2130
[gift_price] => $26
[module] => uc_product
)
[title] => Gift Card
[vid] => 2140
[cost] => 0
[price] => 1
[weight] => 0
[module] => uc_product
[model] => giftcard
) ... etc
但我想這樣做,每個,現在在一個正常的陣列我會通過每個組(在這種情況下$項目),環路,並採取$用品 - >數據[「價格」]並將其分配到$ item [$ x] - >價格
但我不知道如何在PHP中做到這一點。任何幫助?
這會一次返回一個值。因此,對象成爲標題,然後是vid等。而不是單個對象,每個對象都是可訪問的對象。 – Steven
查看第一個代碼,而不是第二個。 – DaveRandom