HTML
<table id='dg' border='0' class="Table">
<tr>
<td class='text'>id.</td>
<td class='text'>file</td>
<td class='text'>alt</td>
</tr>
<tr>
<td class='text'><input name='somename[]' type='hidden' value='1234'>
1</td>
<td class='text'><a href='#' onClick="javascript:openPopWindow('../../somefile.jpg');" ><img src='cms_thumb.php?imgsrc=somefile2.jpg' border='0' ></a></td>
<td class='text'><input type='text' name='title[]' value='Value 1'></td>
</tr>
<tr>
<td class='text'><input name='somename[]2' type='hidden' value='2345'>
2</td>
<td class='text'><a href='#' onClick="javascript:openPopWindow('../../somefile2.jpg');" ><img src='thumb.php?imgsrc=somefile2.jpg' border='0' ></a></td>
<td class='text'><input type='text' name='title[]' value='Value 2'></td>
</tr>
</table>
客观的
需要获取 img src 文件名并获取 name=title[] 的输入字段的值
到目前为止我有什么
$dom = new DOMDocument;
$dom->loadHTML($html);
$xpath = new DOMXpath($dom);
foreach ($dom->getElementsByTagName('tr') as $node) {
$img = $xpath->query('//img')->item(0);
$img = str_replace("\'","",$img->getAttribute('src'));
$img = str_replace("cms_thumb.php?imgsrc=","",$img);
echo $img.'<br>';
}
$img 只包含第一张图片而不是其他图片