php – SimpleXML和名称空间
发布时间:2020-12-13 17:08:16 所属栏目:PHP教程 来源:网络整理
导读:我有以下代码. entry job:location job:id24/job:id job:region6/job:region /job:location /entry 我对命名空间有疑问.我如何在SimpleXML中阅读job:region标签的内容. 解决方法 试试这个: ?php $entry = simplexml_load_file('entry.xml'); printf("%sn"
我有以下代码.
<entry> <job:location> <job:id>24</job:id> <job:region>6</job:region> </job:location> </entry> 我对命名空间有疑问.我如何在SimpleXML中阅读job:region标签的内容. 解决方法
试试这个:
<?php $entry = simplexml_load_file('entry.xml'); printf("%sn",$entry->children('job',true)->location->region); ?> 要检查上面的代码,请单击“here” 有关SimpleXml的更多信息,请参阅此article (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |