当object属性在child std类中时,如何打印对象属性

时间:2013-07-30 05:05:53

标签: php jquery zend-framework cakephp phpmyadmin

你好我想检索std类的productCode值我怎么用std类打印。

所以它有很多std类我很困惑从std类中检索值我想从这个对象打印productcode字段我该怎么做?

stdClass Object ( [id] => 1 [productId] => 5 [productName] => 
SneakVape Vaporizer and FREE BONUS Portable Pollen Press [productUnitePrice] => 26.99 [productDiscountPrice] => 0.00 
[productQty] => 1 
[productSubTotal] => 26.99 
[productCartPrice] => 26.99 
[currencyCode] => stdClass Object ( [id] => 1 [name] => Pound [code] => £ [codeStr] => GBP [isDefault] => Yes ) [currencyCodeStr] => 
stdClass Object ( [id] => 1 [name] => Pound [code] => £ [codeStr] => GBP [isDefault] => Yes ) 
[productInfo] => stdClass Object ( [id] => 5 [productName] => SneakVape Vaporizer and FREE BONUS Portable Pollen Press 
[productSmallDescription] => Sneak Vape Herbal Vaporizer [unitPrice] => 26.99 [discountPrice] => 0.00 
[priceCurrency] => stdClass Object ( [id] => 1 [name] => Pound [code] => £ [codeStr] => GBP [isDefault] => Yes ) 
[weightUnit] => [productWeight] => 0.00 [stockInHand] => 0 [reorderLevel] => 0 [category] => stdClass Object ( [id] => 67 
[category_name] => Vaporizer [category_description] => Sneak Vape Shopping 
[sub_category_description] => Sneak Vape Herbal Vaporizer; [parent_category] => 0 
[status] => Enabled [displayorder] => 200 [subCategory] => Array ( ) ) 
[addedOn] => 2013-07-29 09:10:35 [addedBy] => 1 
[status] => Published [isFeatured] => 
[productDescription] =>

Items Included

Sneak Vape Herbal Vaporizer

FREE PortablePollen Press
[keywords] => [displayOrder] => 0 
[isSpecialOffer] => [productDefaultImage] => stdClass Object ( 
[recordId] => 17 [recordText] => p1805b58vm1h061bve1pp1ko8tc1.jpg [recordListingId] => 1 
[imageObject] => Product [image_title] => 
[image_description] => [image_link] => [imageObjectKeyId] => 5 
[specialTag] => ) 
[productImages] => Array ( [0] => stdClass Object ( 
[recordId] => 17 [recordText] => p1805b58vm1h061bve1pp1ko8tc1.jpg 
[recordListingId] => 1 [imageObject] => Product [image_title] => 
[image_description] => [image_link] => [imageObjectKeyId] => 5 [specialTag] => ) ) 
[productCode] => Juicer - EK3016S ) 
[productBrand] => [productSize] => 
[productImage] => stdClass Object ( [recordId] => 17 [recordText] => p1805b58vm1h061bve1pp1ko8tc1.jpg [recordListingId] => 1 
[imageObject] => Product [image_title] => [image_description] => [image_link] => [imageObjectKeyId] => 5 
[specialTag] => ) 

如何打印[productCode]?

1 个答案:

答案 0 :(得分:2)

您使用对象属性运算符->

echo $obj->productCode;