我的代码看起来像这样
<?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>
。我错过了什么?也许 TIDY 类删除空标签?如果是,我该如何预防?