【发布时间】:2017-07-15 07:13:24
【问题描述】:
我正在使用 simple_html_dom 脚本从网站获取信息。
我正在尝试抓取一个带有 display: none 属性的元素。
这是元素:
<label data-product-attribute-value="1307" class="form-label" for="attribute_1307" style="display: none;">This is the title</label>
如何识别此标记带有内联 CSS display: none;?
这是我的代码:
$html = get_html_data($url);
foreach ($html->find('.form-label') as $links) {
echo $links->outertext;
}
$links->outertext 只给我这个:
<label data-product-attribute-value="1307" class="form-label" for="attribute_1307">This is the title</label>
你可以看到,它在抓取时不包括样式属性。
那么我怎样才能获得内联 CSS 属性呢?如果我必须使用其他库,请提出建议。
【问题讨论】: