Php 整洁\u修复\u字符串删除结束线中断(\n或\r)
将删除行尾的$HTMLcode。 例: 将输出Php 整洁\u修复\u字符串删除结束线中断(\n或\r),php,htmltidy,Php,Htmltidy,将删除行尾的$HTMLcode。 例: 将输出 that's in the main box ##What does it do ? it does everything ##Output: 如果此后该字符串没有回显到标记中,则不会出现问题。因此,字符\n或\r很重要。 我看了一下文档,但没有发现任何明显的东西 有没有办法保留这些换行符 (在使用tidy string repair之前添加标记是个坏主意,因为这会导致浏览器中可见的标记以字符串(已解码)而不是标记的形式出现。)如果
that's in the main box
##What does it do ?
it does everything
##Output:
如果此后该字符串没有回显到标记中,则不会出现问题。因此,字符\n或\r很重要。 我看了一下文档,但没有发现任何明显的东西 有没有办法保留这些换行符
(在使用tidy string repair之前添加标记是个坏主意,因为这会导致浏览器中可见的标记以字符串(已解码)而不是标记的形式出现。)如果我理解正确,您正在尝试格式化html以供人阅读,而您不想使用“pre”标签强制tidy保留空白,因为在将其输出到浏览器之前,您将通过htmlspecialchars运行tidy的输出你为什么不在清洁后去掉那些“pre”标签呢?它看起来是这样的:that's in the main box ##What does it do ? it does everything ##Output: I will giv ea a grat output
$config = array('show-body-only' => true, 'indent' => true); $HTMLcodeOutput = tidy_repair_string('<pre>'.$HTMLcode.'</pre>', $config); $HTMLcodeOutput = substr($HTMLcodeOutput, 5, -6);
$config=array('show-body-only'=>true,'indent'=>true); $HTMLcodeOutput=tidy_repair_字符串(“.$HTMLcode.”,$config); $HTMLcodeOutput=substr($HTMLcodeOutput,5,-6);
$config = array('show-body-only' => true, 'indent' => true); $HTMLcodeOutput = tidy_repair_string('<pre>'.$HTMLcode.'</pre>', $config); $HTMLcodeOutput = substr($HTMLcodeOutput, 5, -6);