如何访问下面的给定对象?
问题描述:
How can I access "atom" from below:
Zend_Gdata_Calendar_EventEntry Object
(
[_entryClassName:protected] => Zend_Gdata_Calendar_EventEntry
[_sendEventNotifications:protected] =>
[_timezone:protected] =>
[_quickadd:protected] =>
[_who:protected] => Array
(
[0] => Zend_Gdata_Extension_Who Object
(
[_rootElement:protected] => who
[_email:protected] => vrock123456@gmail.com
[_rel:protected] => http://schemas.google.com/g/2005#event.organizer
[_valueString:protected] => vrock123456@gmail.com
[_attendeeStatus:protected] =>
[_attendeeType:protected] =>
[_entryLink:protected] =>
[_rootNamespace:protected] => gd
[_rootNamespaceURI:protected] =>
[_extensionElements:protected] => Array
(
)
[_extensionAttributes:protected] => Array
(
)
[_text:protected] =>
[_namespaces:protected] => Array
(
[atom] => Array
(
[1] => Array
(
[0] => http://www.w3.org/2005/Atom
)
)
)
)
)
答
Zend_Gdata_Calendar_EventEntry
has method getWho()
, which returns array of "whos". But in Zend_Gdata_Extension_Who
I don't see method, which returns defined namespaces.
But you can access that property using Reflection - Example #2.
答
1) Show Zend_Gdata_Calendar_EventEntry class
2) Possibly in foreach loop or the class may have some method like as_array() to convert an object into array.