我有一张这样的桌子:
<tr>
<td><font color="#000066">ADANA</font></td>
<td><font color="#000066">SEYHAN</font></td>
<td><font color="#000066">ZÜBEYDE HANIM ANAOKULU</font></td>
<td><font color="#000066">KURTULUŞ MAH.64011 SOK. NO:1</font></td>
<td><font color="#000066">(322) 453 10 60</font></td>
<td><font color="#000066">(322) 459 19 77</font></td>
</tr>
我想得到td的内容。但我无法管理它。
$xml = new DOMDocument();
$xml->validateOnParse = true;
$xml->loadHTML($data);
$xpath = new DOMXPath($xml);
$xpath = new DOMXPath($xml);
$table =$xpath->query("//*[@id='dgKurumListesi']")->item(0);
$rows = $table->getElementsByTagName("tr");
foreach ($rows as $row) {
$cells = $row -> getElementsByTagName('td',0);
foreach ($cells as $cell) {
echo $cell->nodeValue; //il ismi
}
}
我想要这样:$value['firsttd'] , $value['secondtd'], $value['thirdtd']