I know I must be doing something simple wrong. When I do this:
echo '<pre>';
print_r($event->when);
echo '</pre>';
I get this:
Array
(
[0] => Zend_Gdata_Extension_When Object
(
[_rootElement:protected] => when
[_reminders:protected] =>
[_startTime:protected] => 2011-06-16T10:00:00.000-05:00
[_valueString:protected] =>
[_endTime:protected] => 2011-06-17T11:00:00.000-05:00
[_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
)
)
[app] => Array
(
[1] => Array
(
[0] => http://purl.org/atom/app#
)
[2] => Array
(
[0] => http://www.w开发者_StackOverflow社区3.org/2007/app
)
)
[gd] => Array
(
[1] => Array
(
[0] => http://schemas.google.com/g/2005
)
)
[openSearch] => Array
(
[1] => Array
(
[0] => http://a9.com/-/spec/opensearchrss/1.0/
)
[2] => Array
(
[0] => http://a9.com/-/spec/opensearch/1.1/
)
)
[rss] => Array
(
[1] => Array
(
[0] => http://blogs.law.harvard.edu/tech/rss
)
)
)
)
)
I'm then trying to get startTime
by doing this:
$StartTime = $event->when->startTime;
But I'm not getting anything.
And yet, when I do this:
pr($event->published);
I get this:
Zend_Gdata_App_Extension_Published Object
(
[_rootElement:protected] => published
[_rootNamespace:protected] => atom
[_rootNamespaceURI:protected] =>
[_extensionElements:protected] => Array
(
)
[_extensionAttributes:protected] => Array
(
)
[_text:protected] => 2011-06-15T03:32:14.000Z
[_namespaces:protected] => Array
(
[atom] => Array
(
[1] => Array
(
[0] => http://www.w3.org/2005/Atom
)
)
[app] => Array
(
[1] => Array
(
[0] => http://purl.org/atom/app#
)
[2] => Array
(
[0] => http://www.w3.org/2007/app
)
)
)
)
and I can do this:
$dateAdded = $event->published->text;
echo $dateAdded;
and I see an output...
According to to the official Zend_Gdata_Extension_When documentation, there's a method called getStartTime()
which will give you the time.
If you do $event->when[0]->getStartTime()
or $event->when[0]->startTime
, you'll get the start time.
startTime
is marked protected. You can't reference it from outside like you did. There must be a getter function 'getStartTime()' function in that object that would allow you to reference it publicly.
EDIT: Also it is returning an object array - not an single object, so you would need to reference the it like: $event[0]->getterFunction()
or loop through the array with a foreach
accessing the individual objects in the loop
精彩评论