就像是:
find node: qp( $doc, 'UniqueSubNode' );
string representation: Root>Node>InnerNode>UniqueSubNode
在 QP parents() 会得到你所有的祖先,那么你需要做的就是 html() 他们每个人,我希望它有帮助。
参考这个:http ://api.querypath.org/docs/class_query_path.html#aae3c29dfc81839c3c054e7d608facd76
假设您的服务器允许您使用它,您可以使用 DOMDocument 对象。
http://php.net/manual/en/class.domdocument.php
DOMDocument 对象的工作方式与 javascript 的 DOM 操作非常相似。文本值存储在对象的 textContent 成员中。