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.
我正在编写一个 PHP 脚本来提取在其 id 示例中递增的 div id:
<div id="tag_1">content</div> <div id="tag_2">content</div>
所以基本上,我如何使用通配符编写查询 domxpath,如下所示:
$nodes = $xpath->query("//div[@id='tag_.*']");
你可以使用starts-with
"//div/@id[starts-with(., 'tag_')]/.."