我正在使用php简单的dom解析器屏幕抓取器,我正在尝试将其设置为刮取页面的内容。问题是它将数据拉到了ok,但它一遍又一遍地重复它,我无法找出原因。似乎每条记录都重复了好几次。
<?php
// example of how to use basic selector to retrieve HTML contents
include('../simple_html_dom.php');
// get DOM from URL or file
$html = file_get_html('http://www.goldengrovenursery.co.uk/griffin_x/results.asp?txtgenus=Chamaecyparis&txtcultivar=&txtcolour=All&Search=Availability&offset=40');
echo '<table>
<thead><th>Genus</th><th>Cultivar</th></thead>
<tbody>';
foreach($html->find('td.genus') as $a)
foreach($html->find('td.cultivar') as $b)
foreach($html->find('td.species') as $c)
echo '<tr><td>'.$a->innertext.'</td><td>'.$b->innertext.'</td><td>'.$c->innertext.'</td></tr>';
echo '</tbody>
</table>
';
?>
上面的脚本最终看起来像这样,即使页面上只有10条记录:
Genus Cultivar
Genus Colour
Genus pisifera
Genus pisifera
Genus pisifera
Genus pisifera
Genus pisifera
Genus thyoides
Genus obtusa
Genus lawsoniana
Genus obtusa
Genus pisifera
Genus Colour
Genus pisifera
Genus pisifera
Genus pisifera
Genus pisifera
Genus pisifera
Genus thyoides
Genus obtusa
Genus lawsoniana
Genus obtusa
Genus pisifera
Genus Colour
Genus pisifera
Genus pisifera
Genus pisifera
Genus pisifera
Genus pisifera
Genus thyoides
Genus obtusa
Genus lawsoniana
Genus obtusa
Genus pisifera
Genus Cultivar Colour
Genus Cultivar pisifera
Genus Cultivar pisifera
Genus Cultivar pisifera
Genus Cultivar pisifera
Genus Cultivar pisifera
Genus Cultivar thyoides
Genus Cultivar obtusa
Genus Cultivar lawsoniana
Genus Cultivar obtusa
Genus Cultivar pisifera
Genus Colour
Genus pisifera
Genus pisifera
Genus pisifera
Genus pisifera
Genus pisifera
Genus thyoides
Genus obtusa
Genus lawsoniana
Genus obtusa
Genus pisifera
Genus FILIFERA NANA Colour
Genus FILIFERA NANA pisifera
Genus FILIFERA NANA pisifera
Genus FILIFERA NANA pisifera
Genus FILIFERA NANA pisifera
Genus FILIFERA NANA pisifera
Genus FILIFERA NANA thyoides
Genus FILIFERA NANA obtusa
Genus FILIFERA NANA lawsoniana
Genus FILIFERA NANA obtusa
Genus FILIFERA NANA pisifera
Genus NANA Colour
Genus NANA pisifera
Genus NANA pisifera
Genus NANA pisifera
Genus NANA pisifera
Genus NANA pisifera
Genus NANA thyoides
Genus NANA obtusa
Genus NANA lawsoniana
Genus NANA obtusa
Genus NANA pisifera
Genus NANA AUREOVARIEGATA Colour
Genus NANA AUREOVARIEGATA pisifera
Genus NANA AUREOVARIEGATA pisifera
Genus NANA AUREOVARIEGATA pisifera
Genus NANA AUREOVARIEGATA pisifera
Genus NANA AUREOVARIEGATA pisifera
Genus NANA AUREOVARIEGATA thyoides
Genus NANA AUREOVARIEGATA obtusa
Genus NANA AUREOVARIEGATA lawsoniana
Genus NANA AUREOVARIEGATA obtusa
Genus NANA AUREOVARIEGATA pisifera
Genus SQUARROSA SULPHUREA Colour
Genus SQUARROSA SULPHUREA pisifera
Genus SQUARROSA SULPHUREA pisifera
Genus SQUARROSA SULPHUREA pisifera
Genus SQUARROSA SULPHUREA pisifera
Genus SQUARROSA SULPHUREA pisifera
Genus SQUARROSA SULPHUREA thyoides
Genus SQUARROSA SULPHUREA obtusa
Genus SQUARROSA SULPHUREA lawsoniana
Genus SQUARROSA SULPHUREA obtusa
Genus SQUARROSA SULPHUREA pisifera
Genus SUNGOLD Colour
Genus SUNGOLD pisifera
Genus SUNGOLD pisifera
Genus SUNGOLD pisifera
Genus SUNGOLD pisifera
Genus SUNGOLD pisifera
Genus SUNGOLD thyoides
Genus SUNGOLD obtusa
Genus SUNGOLD lawsoniana
Genus SUNGOLD obtusa
Genus SUNGOLD pisifera
Genus TOP POINT Colour
Genus TOP POINT pisifera
Genus TOP POINT pisifera
Genus TOP POINT pisifera
Genus TOP POINT pisifera
Genus TOP POINT pisifera
Genus TOP POINT thyoides
Genus TOP POINT obtusa
Genus TOP POINT lawsoniana
Genus TOP POINT obtusa
Genus TOP POINT pisifera
Genus TSATSUMI GOLD Colour
Genus TSATSUMI GOLD pisifera
Genus TSATSUMI GOLD pisifera
Genus TSATSUMI GOLD pisifera
Genus TSATSUMI GOLD pisifera
Genus TSATSUMI GOLD pisifera
Genus TSATSUMI GOLD thyoides
Genus TSATSUMI GOLD obtusa
Genus TSATSUMI GOLD lawsoniana
Genus TSATSUMI GOLD obtusa
Genus TSATSUMI GOLD pisifera
Genus NICHOLE Colour
Genus NICHOLE pisifera
Genus NICHOLE pisifera
Genus NICHOLE pisifera
Genus NICHOLE pisifera
Genus NICHOLE pisifera
Genus NICHOLE thyoides
Genus NICHOLE obtusa
Genus NICHOLE lawsoniana
Genus NICHOLE obtusa
Genus NICHOLE pisifera
Genus RIGID DWARF Colour
Genus RIGID DWARF pisifera
Genus RIGID DWARF pisifera
Genus RIGID DWARF pisifera
Genus RIGID DWARF pisifera
Genus RIGID DWARF pisifera
Genus RIGID DWARF thyoides
Genus RIGID DWARF obtusa
Genus RIGID DWARF lawsoniana
Genus RIGID DWARF obtusa
Genus RIGID DWARF pisifera
Genus TRUE BLUE Colour
Genus TRUE BLUE pisifera
Genus TRUE BLUE pisifera
Genus TRUE BLUE pisifera
Genus TRUE BLUE pisifera
Genus TRUE BLUE pisifera
Genus TRUE BLUE thyoides
Genus TRUE BLUE obtusa
Genus TRUE BLUE lawsoniana
Genus TRUE BLUE obtusa
Genus TRUE BLUE pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Cultivar Colour
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar thyoides
Chamaecyparis Cultivar obtusa
Chamaecyparis Cultivar lawsoniana
Chamaecyparis Cultivar obtusa
Chamaecyparis Cultivar pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis FILIFERA NANA Colour
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA thyoides
Chamaecyparis FILIFERA NANA obtusa
Chamaecyparis FILIFERA NANA lawsoniana
Chamaecyparis FILIFERA NANA obtusa
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis NANA Colour
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA thyoides
Chamaecyparis NANA obtusa
Chamaecyparis NANA lawsoniana
Chamaecyparis NANA obtusa
Chamaecyparis NANA pisifera
Chamaecyparis NANA AUREOVARIEGATA Colour
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA thyoides
Chamaecyparis NANA AUREOVARIEGATA obtusa
Chamaecyparis NANA AUREOVARIEGATA lawsoniana
Chamaecyparis NANA AUREOVARIEGATA obtusa
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis SQUARROSA SULPHUREA Colour
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA thyoides
Chamaecyparis SQUARROSA SULPHUREA obtusa
Chamaecyparis SQUARROSA SULPHUREA lawsoniana
Chamaecyparis SQUARROSA SULPHUREA obtusa
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SUNGOLD Colour
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD thyoides
Chamaecyparis SUNGOLD obtusa
Chamaecyparis SUNGOLD lawsoniana
Chamaecyparis SUNGOLD obtusa
Chamaecyparis SUNGOLD pisifera
Chamaecyparis TOP POINT Colour
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT thyoides
Chamaecyparis TOP POINT obtusa
Chamaecyparis TOP POINT lawsoniana
Chamaecyparis TOP POINT obtusa
Chamaecyparis TOP POINT pisifera
Chamaecyparis TSATSUMI GOLD Colour
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD thyoides
Chamaecyparis TSATSUMI GOLD obtusa
Chamaecyparis TSATSUMI GOLD lawsoniana
Chamaecyparis TSATSUMI GOLD obtusa
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis NICHOLE Colour
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE thyoides
Chamaecyparis NICHOLE obtusa
Chamaecyparis NICHOLE lawsoniana
Chamaecyparis NICHOLE obtusa
Chamaecyparis NICHOLE pisifera
Chamaecyparis RIGID DWARF Colour
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF thyoides
Chamaecyparis RIGID DWARF obtusa
Chamaecyparis RIGID DWARF lawsoniana
Chamaecyparis RIGID DWARF obtusa
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis TRUE BLUE Colour
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE thyoides
Chamaecyparis TRUE BLUE obtusa
Chamaecyparis TRUE BLUE lawsoniana
Chamaecyparis TRUE BLUE obtusa
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Cultivar Colour
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar thyoides
Chamaecyparis Cultivar obtusa
Chamaecyparis Cultivar lawsoniana
Chamaecyparis Cultivar obtusa
Chamaecyparis Cultivar pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis FILIFERA NANA Colour
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA thyoides
Chamaecyparis FILIFERA NANA obtusa
Chamaecyparis FILIFERA NANA lawsoniana
Chamaecyparis FILIFERA NANA obtusa
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis NANA Colour
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA thyoides
Chamaecyparis NANA obtusa
Chamaecyparis NANA lawsoniana
Chamaecyparis NANA obtusa
Chamaecyparis NANA pisifera
Chamaecyparis NANA AUREOVARIEGATA Colour
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA thyoides
Chamaecyparis NANA AUREOVARIEGATA obtusa
Chamaecyparis NANA AUREOVARIEGATA lawsoniana
Chamaecyparis NANA AUREOVARIEGATA obtusa
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis SQUARROSA SULPHUREA Colour
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA thyoides
Chamaecyparis SQUARROSA SULPHUREA obtusa
Chamaecyparis SQUARROSA SULPHUREA lawsoniana
Chamaecyparis SQUARROSA SULPHUREA obtusa
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SUNGOLD Colour
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD thyoides
Chamaecyparis SUNGOLD obtusa
Chamaecyparis SUNGOLD lawsoniana
Chamaecyparis SUNGOLD obtusa
Chamaecyparis SUNGOLD pisifera
Chamaecyparis TOP POINT Colour
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT thyoides
Chamaecyparis TOP POINT obtusa
Chamaecyparis TOP POINT lawsoniana
Chamaecyparis TOP POINT obtusa
Chamaecyparis TOP POINT pisifera
Chamaecyparis TSATSUMI GOLD Colour
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD thyoides
Chamaecyparis TSATSUMI GOLD obtusa
Chamaecyparis TSATSUMI GOLD lawsoniana
Chamaecyparis TSATSUMI GOLD obtusa
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis NICHOLE Colour
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE thyoides
Chamaecyparis NICHOLE obtusa
Chamaecyparis NICHOLE lawsoniana
Chamaecyparis NICHOLE obtusa
Chamaecyparis NICHOLE pisifera
Chamaecyparis RIGID DWARF Colour
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF thyoides
Chamaecyparis RIGID DWARF obtusa
Chamaecyparis RIGID DWARF lawsoniana
Chamaecyparis RIGID DWARF obtusa
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis TRUE BLUE Colour
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE thyoides
Chamaecyparis TRUE BLUE obtusa
Chamaecyparis TRUE BLUE lawsoniana
Chamaecyparis TRUE BLUE obtusa
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Cultivar Colour
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar thyoides
Chamaecyparis Cultivar obtusa
Chamaecyparis Cultivar lawsoniana
Chamaecyparis Cultivar obtusa
Chamaecyparis Cultivar pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis FILIFERA NANA Colour
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis FILIFERA NANA thyoides
Chamaecyparis FILIFERA NANA obtusa
Chamaecyparis FILIFERA NANA lawsoniana
Chamaecyparis FILIFERA NANA obtusa
Chamaecyparis FILIFERA NANA pisifera
Chamaecyparis NANA Colour
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA pisifera
Chamaecyparis NANA thyoides
Chamaecyparis NANA obtusa
Chamaecyparis NANA lawsoniana
Chamaecyparis NANA obtusa
Chamaecyparis NANA pisifera
Chamaecyparis NANA AUREOVARIEGATA Colour
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis NANA AUREOVARIEGATA thyoides
Chamaecyparis NANA AUREOVARIEGATA obtusa
Chamaecyparis NANA AUREOVARIEGATA lawsoniana
Chamaecyparis NANA AUREOVARIEGATA obtusa
Chamaecyparis NANA AUREOVARIEGATA pisifera
Chamaecyparis SQUARROSA SULPHUREA Colour
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SQUARROSA SULPHUREA thyoides
Chamaecyparis SQUARROSA SULPHUREA obtusa
Chamaecyparis SQUARROSA SULPHUREA lawsoniana
Chamaecyparis SQUARROSA SULPHUREA obtusa
Chamaecyparis SQUARROSA SULPHUREA pisifera
Chamaecyparis SUNGOLD Colour
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD pisifera
Chamaecyparis SUNGOLD thyoides
Chamaecyparis SUNGOLD obtusa
Chamaecyparis SUNGOLD lawsoniana
Chamaecyparis SUNGOLD obtusa
Chamaecyparis SUNGOLD pisifera
Chamaecyparis TOP POINT Colour
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT pisifera
Chamaecyparis TOP POINT thyoides
Chamaecyparis TOP POINT obtusa
Chamaecyparis TOP POINT lawsoniana
Chamaecyparis TOP POINT obtusa
Chamaecyparis TOP POINT pisifera
Chamaecyparis TSATSUMI GOLD Colour
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis TSATSUMI GOLD thyoides
Chamaecyparis TSATSUMI GOLD obtusa
Chamaecyparis TSATSUMI GOLD lawsoniana
Chamaecyparis TSATSUMI GOLD obtusa
Chamaecyparis TSATSUMI GOLD pisifera
Chamaecyparis NICHOLE Colour
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE pisifera
Chamaecyparis NICHOLE thyoides
Chamaecyparis NICHOLE obtusa
Chamaecyparis NICHOLE lawsoniana
Chamaecyparis NICHOLE obtusa
Chamaecyparis NICHOLE pisifera
Chamaecyparis RIGID DWARF Colour
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis RIGID DWARF thyoides
Chamaecyparis RIGID DWARF obtusa
Chamaecyparis RIGID DWARF lawsoniana
Chamaecyparis RIGID DWARF obtusa
Chamaecyparis RIGID DWARF pisifera
Chamaecyparis TRUE BLUE Colour
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis TRUE BLUE thyoides
Chamaecyparis TRUE BLUE obtusa
Chamaecyparis TRUE BLUE lawsoniana
Chamaecyparis TRUE BLUE obtusa
Chamaecyparis TRUE BLUE pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
Chamaecyparis Cultivar Colour
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar pisifera
Chamaecyparis Cultivar thyoides
Chamaecyparis Cultivar obtusa
Chamaecyparis Cultivar lawsoniana
Chamaecyparis Cultivar obtusa
Chamaecyparis Cultivar pisifera
Chamaecyparis Colour
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis pisifera
Chamaecyparis thyoides
Chamaecyparis obtusa
Chamaecyparis lawsoniana
Chamaecyparis obtusa
Chamaecyparis pisifera
答案 0 :(得分:2)
您使用第二个cultivar
循环搜索整个文档foreach()
,而不仅仅是您在第一个genus
找到的foreach()
;对于species
cultivar
也是如此
但是因为每个条目实际上都在嵌套表中的自己的行中,所以你还需要通过dom回溯每个条目:
foreach($html->find('td.genus') as $a)
foreach($a->parent()->parent()->find('td.cultivar') as $b)
foreach($b->parent()->parent()->find('td.species') as $c)
更好的变量命名也可能使这一点更清晰:
foreach($html->find('td.genus') as $genus) {
foreach($genus->parent()->parent()->find('td.cultivar') as $cultivar) {
foreach($cultivar->parent()->parent()->find('td.species') as $species) {
echo '<tr><td>' .
$genus->innertext .
'</td><td>' .
$cultivar->innertext .
'</td><td>' .
$species->innertext.
'</td></tr>';
}
}
}
答案 1 :(得分:0)
检查此解决方案
<?php
// example of how to use basic selector to retrieve HTML contents
include('simple_html_dom.php');
// get DOM from URL or file
$html = file_get_html('http://www.goldengrovenursery.co.uk/griffin_x/results.asp?txtgenus=Chamaecyparis&txtcultivar=&txtcolour=All&Search=Availability&offset=40');
echo "<div style='float:left'>";
foreach($html->find('td.genus') as $genus)
echo '<div>'.$genus->innertext.'</div>';
echo "</div><div style='float:left'>";
foreach($html->find('td.cultivar') as $species)
echo '<div>'.$species->innertext.'</div>';
echo '</div><div>';
foreach($html->find('td.species') as $cultivar)
echo '<div>'.$cultivar->innertext.'</div>';
echo '</div>
';
?>