如何获取具有特定类名的所有行,例如:
<tr class="dailyeventtext" bgcolor="#cfcfcf" valign="top">
然后将该行中的每个单元格放入一个数组中?
我使用cURL从客户端的服务器上获取页面.
$matches = array();
$dom = new DOMDocument;
$dom->loadHTML($html);
foreach($dom->getElementsByTagName('tr') as $tr) {
    if ( ! $tr->hasAttribute('class')) {
       continue;
    }
    $class = explode(' ', $tr->getAttribute('class'));
    if (in_array('dailyeventtext', $class)) {
       $matches[] = $tr->getElementsByTagName('td');
    }
}
| 归档时间: | 
 | 
| 查看次数: | 4435 次 | 
| 最近记录: |