将 PHPQuery 结果作为 DOMDocument 对象获取


Getting PHPQuery results as DOMDocument objects?

现在,我从PHPQuery获取字符串的结果,然后使用DOMDocument解析字符串。由于 PHPQuery 使用 DOMDocument,我是否可以从 PHPQuery 获取结果作为 DOMDocument 对象?我该怎么做?

一旦你得到一个phpQueryObject,你可以使用公共函数访问DomDocument getDOMDocument()

pq('whatever')->getDocument()->getDOMDocument();