我使用简单的 HTML Dom 从页面上的表格中返回一个数组,表格是这样的
<table width="414" cellspacing="4" cellpadding="0" border="0">
<tbody>
<tr>
<td width="170">Total :</td>
<td>58,262</td>
</tr>
... // there are about another 10 <tr> tags, and table closing tags after that.
但是当我运行命令时,print_r($es = $html->find('table[width=414]'));
我返回了一个巨大的数组(与它的解析相反),下面的示例将我们带到第一个“Total:”行,接下来是下面大约 200 行。有什么想法可以让我得到更“消毒”的结果吗?
Array ( [0] => simple_html_dom_node Object ( [nodetype] => 1 [tag] => table [attr] => Array ( [cellpadding] => 0 [cellspacing] => 4 [border] => 0 [width] => 414 ) [children] => Array ( [0] => simple_html_dom_node Object ( [nodetype] => 1 [tag] => tr [attr] => Array ( ) [children] => Array ( [0] => simple_html_dom_node Object ( [nodetype] => 1 [tag] => td [attr] => Array ( [width] => 170 ) [children] => Array ( ) [nodes] => Array ( [0] => simple_html_dom_node Object ( [nodetype] => 3 [tag] => text [attr] => Array ( ) [children] => Array ( ) [nodes] => Array ( ) [parent] => simple_html_dom_node Object *RECURSION* [_] => Array ( [4] => Total : )