Php 将元素从display none更改为display block simple html dom

Php 将元素从display none更改为display block simple html dom,php,web-scraping,simple-html-dom,Php,Web Scraping,Simple Html Dom,这就是我所拥有的,它工作得非常完美: include('simple_html_dom.php'); // Create DOM from URL or file $html = file_get_html('http://localhost/index.html'); 在这个页面中有一个叫做“电话号码”的按钮,一旦你点击它就会打开一个div <div class="phone" style="display: none;"> <span class="number">

这就是我所拥有的,它工作得非常完美:

include('simple_html_dom.php');
// Create DOM from URL or file
$html = file_get_html('http://localhost/index.html');
在这个页面中有一个叫做“电话号码”的按钮,一旦你点击它就会打开一个div

<div class="phone" style="display: none;">
<span class="number"> 212-222-3453</span>
</div>

212-222-3453

在我刮取数据之前,是否有其他方法将其更改为显示:block?

是的,使用以下代码

include('simple_html_dom.php');
$html = file_get_html('index.html');
$phoneArray = $html->find('div[class=phone]'); 
$phoneArray[0]->style="display:block";