我的代码看起来像这样
<?php
ob_start();
?>
....
Some HTML
...
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
<strong>Alert:</strong> Sample ui-state-error style.</p>
</div>
....
Some HTML
...
<?php
$markup = ob_get_clean();
// Specify configuration
$config = array(
'indent' => true,
'output-xhtml' => true,
'wrap' => 200);
// Tidy
$tidy = new tidy;
$tidy->parseString($markup, $config, 'utf8');
$tidy->cleanRepair();
// Output
echo $tidy;
?>在没有<span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>的情况下获取结果。我遗漏了什么?也许整洁的类删除了空标签?如果是,我如何防止它?
发布于 2012-09-02 22:45:38
我发表了一条评论:“你有没有试过在跨度内添加 或一些文本,以确保它们被删除了,因为它是空的?”而且看起来 起作用了。
因此,如果有人有相同的问题,并来到这里,解决方案是:
在空元素内添加 。
https://stackoverflow.com/questions/12236345
复制相似问题