我的代码看起来像这样
$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();
有一个大问题:我的 web php 代码从包含编程材料(如包含等)的数据库中获取字符串,而 tidy 被<stdio>
为错误的标签,"修复"(将其从输出中删除)有没有办法只缩进代码?我的意思是不要修理和去除像<stdio>
这样的部分材料??
我认为htmspecialchars()和htmlspecialchars_decode()函数可能会对您有所帮助。