如何使用PHP选择XML属性
我有一个XML,我想在其中选择一个特定的属性。 XML中的一个条目如下所示:如何使用PHP选择XML属性,php,xml,Php,Xml,我有一个XML,我想在其中选择一个特定的属性。 XML中的一个条目如下所示: <show time="27652"> <user cn="User5" guid="abc" e164="15" h323="User5" text="100000" loc="Everywhere" node="root" filter="normal" cd-filter="normal" reporting="true" uclic="true" type="ep"> <
<show time="27652">
<user cn="User5" guid="abc" e164="15" h323="User5" text="100000" loc="Everywhere" node="root" filter="normal" cd-filter="normal" reporting="true" uclic="true" type="ep">
<presence c="tel:" s="closed" a="vacation"/>
<device hw="user-5"/>
<grp name="TAPI"/>
<grp name="soap"/>
</user>
</show>
这不起作用,它没有显示任何内容。虽然我把它改成了文本=100000
我还打印变量$show以查看是否有错误。更改前:
SimpleXMLElement Object (
[user] => SimpleXMLElement Object (
[@attributes] => Array (
[cn] => User5
)
)
)
修改后:
SimpleXMLElement Object (
[user] => SimpleXMLElement Object (
[@attributes] => Array (
[text] => 100000
)
)
)
我觉得这个也不错。那么,我的错误在哪里
$showresult为空,$master是连接详细信息。。。
多谢各位
SimpleXMLElement Object (
[user] => SimpleXMLElement Object (
[@attributes] => Array (
[cn] => User5
)
)
)
SimpleXMLElement Object (
[user] => SimpleXMLElement Object (
[@attributes] => Array (
[text] => 100000
)
)
)