[英]How to get href from anchor tag with particular class
如果我有HTML文档,最好的浏览文档的最佳方法是使用PHP从具有特定类的所有锚标签中收集href值?
See soulmerge's answer to "Preg_match_all href" . 请参阅soulmerge对“ Preg_match_all href”的回答 。 Adjust the XPath to
将XPath调整为
//a[@class="foo"]/@href
to get a DOMNodeList of all href attributes belonging to elements with a class of foo
. 获取所有属于
foo
类元素的href属性的DOMNodeList。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.