【发布时间】:2013-04-04 16:00:59
【问题描述】:
我正在尝试使用作为 PHP (http://www.php.net/manual/en/book.tidy.php) 一部分的 HTML Tidy 实现来重新格式化大量 HTML。我遇到了一个问题,其中 Tidy 将输出截断超过某个点(大约 8K)。
当我创建一个大约 10K 长的字符串并将其交给 tidy_repair_string 时,如下所示:
$output = tidy_repair_string($output, array(
'indent' => true, // enforce indentation
'hide-comments' => true, // Remove the comments
'wrap' => 100, // Break each line after 100 chars
'output-html' => true, // Output as HTML
'char-encoding' => $encoding // The input/output encoding
), $encoding);
我删除了 8,070 个字符后的所有内容。如果我用 10 个字符填充字符串的开头,那么末尾正好有 10 个字符。
有没有办法更改 tidy_repair_string 的缓冲区大小,使其更大?
看着http://www.php.net/manual/en/tidy.getconfig.php,似乎没有配置选项,Google 非常无用/我的 Google-fu 让我失望了,而且没有大量的文档。任何帮助将不胜感激!
编辑:我在 Windows 7 上使用 xampp-portable-lite-win32-1.8.1-VC9。即使我将 php.ini 更改为使用 memory_limit = 900M,问题仍然存在
【问题讨论】:
-
可能是存入文件并解析文件,而不是字符串?