Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 对象属性在子std类中时如何打印对象属性_Php_Jquery_Zend Framework_Cakephp_Phpmyadmin - Fatal编程技术网

Php 对象属性在子std类中时如何打印对象属性

Php 对象属性在子std类中时如何打印对象属性,php,jquery,zend-framework,cakephp,phpmyadmin,Php,Jquery,Zend Framework,Cakephp,Phpmyadmin,您好,我想检索productCode值的std类如何使用std类打印 所以它有很多std类,我很困惑从std类中检索值,我想从这个对象打印productcode字段,我该怎么做 stdClass Object ( [id] => 1 [productId] => 5 [productName] => SneakVape Vaporizer and FREE BONUS Portable Pollen Press [productUnitePrice] => 26.99

您好,我想检索productCode值的std类如何使用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]?

您使用对象属性操作符
->

echo $obj->productCode;

谢谢,但调用非对象sdt classI时仍然出错。我在子stdclass$obj->productInfo->productCode中找到了答案。谢谢