$HTMLcodeOutput = tidy_repair_string($HTMLcode, array('show-body-only' => true, 'indent' => true));
将删除行末的$HTMLcode。 例如:
that's in the main box
##What does it do ?
it does everything
##Output:
将输出
that's in the main box ##What does it do ? it does everything
##Output: I will giv ea a grat output
如果这个字符串被输出到一个 <pre> 标签中,那么这就成了一个问题。因此,\n 或 \r 字符是重要的。 我查看了文档,但没有找到明显的解决方案。 有没有办法保留这些换行字符? (在使用整洁字符串修复之前添加 <br> 标签是一个坏主意,因为它会将 <pre> 标签作为字符串(已解码)显示在浏览器中,而不是作为标签。)