日期:2014-05-17 浏览次数:20516 次
$htmls = <<<EOT
<div id="content">
Main content.
</div>
<div id="comment">
<ul>
<li class="comment">
<div class="header-comment">
Comment:
<span class="date-comment">8/11/2012, 21:25</span>
</div>
<h4>Some Text</h4>
<p class="test-comment">Blah~~ Blah~~ Blah~~</p>
<div class="share">
<div class="vote">
<a class="vota yes" title="Like">2</a>
<a class="vota no" title="Unlike">0</a>
</div>
</div>
</li>
<li class="comment">
<div class="header-comment">
Comment:
<span class="date-comment">8/11/2012, 23:08</span>
</div>
<h4>Other Text</h4>
<p class="test-comment">Blah~~ Blah~~ Blah~~</p>
<div class="share">
<div class="vote">
<a class="vota yes" title="Like">4</a>
<a class="vota no" title="Unlike">0</a>
</div>
</div>
</li>
</ul>
</div>
EOT;
$htmls = preg_replace('/<div[^>]*(comment|share)[^>]*>(.*?)<\/div>/is', '', $htmls);
echo $htmls;
</div>
<div id="footer">
Footer content.
</div>
EOT;