<div id="a">
<div id="b">
Foo
</div>
<div id="m">
Bar
</div>
</div>
I want find all object in id="a" and out put is
<div id="a"> <div id="b"> Foo </div> <div id="m"> Bar </div> </div>
Geat thanks.
SimpleHTMLDom is memory consuming solution. It may cause memory leaks. I recommend using DOMDocument and DOMXPath . Then you can fetch all div#a by this way:
$xpath->query('//div[@id = "a"]')
Seems the community has responded to this before as a bad idea. Looks to be other, better ways. Jquery, HTML parsers, etc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.