【发布时间】:2012-11-06 01:18:06
【问题描述】:
我正在使用 php Querypath,我正在尝试从 html 字符串中删除所有出现在 html 顶部和底部的空标记。例如:
<div> </div>
<div> </div>
<div>I want remove empty div tag on top and bottom</div>
<div> </div>
<div>other content</div>
<div> </div>
<div> </div>
使用 php 查询路径我想更改为:
<div>I want remove empty div tag on top and bottom</div>
<div> </div>
<div>other content</div>
我该怎么办?
【问题讨论】:
-
所以你想在中间保留一个
&nbsp;。然后你尝试使用 PHP DOM,php.net/manual/en/book.dom.php
标签: php html-parsing querypath