更新时间:2023-02-26 10:24:08
<?php
include("simple_html_dom.php");
$html = "<a id='tag1'>A</a>
<a id='tag2'>B</a>
<a id='tag3'>C</a>
";
$dom = str_get_html($html);
$select = NULL;
foreach($dom->find('a') as $element) {
if ($element->innertext === "B") {
$select = $element;
break;
}
}
?>