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.
<root> <pages> <page> <title>Home</title> <content>Lorem Ipsum</content> </page> </pages> </root>
假设我有一个包含“Home”的变量,我想获取<content>兄弟节点中的内容,例如:"Get -content- Where -title- = VARIABLE"
<content>
"Get -content- Where -title- = VARIABLE"
foreach ($xml->pages->page as $page) { if ((string) $page->title == 'Home') { return (string) $page->content; } }