对“默认”的 XML 访问属性
只是好奇如何使用 php 和 simplexml 从该 xml 文档的“startTime”获取信息
<event xmlns="http://schemas.google.com/contact/2008" xmlns:default="http://schemas.google.com/g/2005" rel="anniversary">
<default:when xmlns="http://schemas.google.com/g/2005" startTime="2009-05-09"/>
</event>
我最初的想法是。
$xml->event->default['startTime']
或者
$xml->event->when['startTime']
但是两者都返回 NULL...当我可以看到数据不为 NULL 时。 关于如何获取这些信息有什么想法吗?
Just curious how to obtain the information from "startTime" of this xml document using php and simplexml
<event xmlns="http://schemas.google.com/contact/2008" xmlns:default="http://schemas.google.com/g/2005" rel="anniversary">
<default:when xmlns="http://schemas.google.com/g/2005" startTime="2009-05-09"/>
</event>
My initial thought was.
$xml->event->default['startTime']
OR
$xml->event->when['startTime']
But both return NULL... when I can see the data isn't NULL.
Any thoughts on how to obtain this information?
经过更多研究后,我发现了这一点,并且运行良好。
Well after much more research I found this as a result and is working perfectly.