我试图从具有 id 的表中获取 td 字段sid-120390923
或sid-38737122
忽略表中的任何其他 id 值,但问题是我无法获取这些 td 字段,因为它们的 id 略有不同但具有相同的开始('sid ')。
我想要的是能够获取所有带有起始 id 的 td 字段sid-
,有没有办法合并正则表达式?
这是一个例子
html
<table>
<tr>
<td id='9sd'></td>
<td id='10sd'></td>
<td id='sid-1239812983'></td>
<td id='sid-1454345345'></td>
<td id='sid-2342345234'></td>
<td id='sid-5656433455'></td>
<td id='sid-1231235664'></td>
<td id='sid-8986757575'></td>
<td id='sid-1232134551'></td>
</tr>
</table>
simple_html_dom
$table = $con->find('table');
foreach($table->find('td#sid-1232134551') as $field){
echo $field."<br>";
}