<table border="3" rules="all" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td align="center">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial" color="#000000"> <b>Maandag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Dinsdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Woensdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Donderdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Vrijdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>1</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="18" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *verlof </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>2</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>3</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>4</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>5</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> stip </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> Os1 </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>6</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>7</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>8</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>9</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
</tbody>
</table>
&#13;
simplehtmldom中的哪些查询可用于仅选择第一个表行? 像这样:表 - &gt; (所有行)
当我尝试此查询时:echo($html->find('table tr',0));
我将零更改为2(例如),它不会返回主表的下一个表行。但相反,它返回第一个表行中子表的frist表行。
并非我无法改变表格的呈现方式,这是我必须使用的表格。
执行时我现在得到的内容:echo($html->find('table tr',2));
- &gt; &#34; Maandag&#34;
我想得到的是:<tr><td rowspan="2" align="center" nowrap="1"><table><tbody><tr><td align="center" nowrap="1"><font size="2" face="Arial"> <b>2</b> </font> </td> </tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td></td></tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> </td> </tr><tr><td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font> </td> </tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> </td> </tr><tr><td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font> </td> </tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td></td></tr></tbody></table></td></tr>
(第一个(主要)表的下一个表格)
我在html表中加载的方式:
$html = file_get_html($timetableURL);
$timeTable = $html->find('table',0); //I need to do this because the page with the timetable has more html tables, I tested this and it always fetches the timetable as seen above.
相关问题:PHP Simple HTML DOM Parser how to get TR only from first table 我只想选择第一个表的第二行或第三行。
echo($timeTable->find('tr',2));
答案 0 :(得分:1)
简单的html-dom有点令人费解:
// find the first table
$table = $html->find('table', 0);
// iterate all tr's
foreach($table->find('tr') as $tr){
// skip the tr's that are not top level
if($tr->parent->parent != $table) continue;
do_something_with($tr);
}
答案 1 :(得分:1)
我使用了while循环和simple-html-dom nextSibling()函数。
$tableCell = $row->find('td', 0);
while($tableCell){
$tableCell = $tableCell->next_sibling(); //Go to the next tableCell
}
答案 2 :(得分:0)
您可以使用jQuery选择器:first
从DOM中获取第一个元素
你可以这样做:
$(function() {
var table = $('table:first');
var table_rows = table.find('tr');
alert(" There are " + table_rows.length + " rows in Table");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table border="3" rules="all" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td align="center">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial" color="#000000"> <b>Maandag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Dinsdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Woensdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Donderdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Vrijdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>1</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="18" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *verlof </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>2</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>3</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>4</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>5</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> stip </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> Os1 </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>6</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>7</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>8</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>9</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
</tbody>
</table>
希望这有帮助!
答案 3 :(得分:0)
遍历您的DOM结构,我发现您想要的tr
是第4个子tr,它直接位于tbody
下的table
元素下。
因此,您需要的查询可能是这样的
// assume table is the root/parent DOM
$tr = $table->find('tbody > tr:nth-child(4)');
var_dump($tr->html());
很抱歉,如果php语法不正确。这实际上是针对phpquery库进行测试的。