Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望在一些可选的 XML 数据上运行某种循环。
节点可能看起来像这样:
<link1> <url>http://www.bleh.com</url> <text>Click here</text> </link1> <link2> <url>bleh.com</url> <text>Click here</text> </link2>
确定这些节点是否存在并相应地解析它们的最佳方法是什么?
如果您使用的是 SimpleXML,那么您可以简单地使用 isset() 来确定节点是否存在。