这就是我所拥有的:
$nodeValues = $crawler->filter("#as-responses-table > tr > td")->each(function ($node) {
// What do I do here?
});
我想要做的是分析每个<td>
- 这意味着我希望能够读取属性。我想读取td的值(即标签之间的内容)。
我到底该怎么做?
每个$node
都是一个Crawler,我希望能够查看HTML。
由于
答案 0 :(得分:1)
读取节点属性
$attribute = $node->attr('attribute_name');
获取节点内容
$content = $node->text();
http://api.symfony.com/2.7/Symfony/Component/DomCrawler/Crawler.html