tidy的ob_tidyhandler 不是太好用~~


稍微不好用,主要config设进去麻烦,那就重写了他,这个函数还包含了gzip压缩
一举两得~~当然啦apache有压缩的,就干掉ob_gzhandler就行啦

header(“Content-Encoding: gzip”);
ob_start(‘tidyhandler’);
function tidyhandler($buff)
{
$config = array(‘indent’ => TRUE,
‘output-xhtml’ => TRUE,
‘wrap’ => 200);
$tidy = tidy_parse_string($buff, $config);
$tidy->cleanRepair();
return ob_gzhandler(tidy_get_output($tidy),5);
}

  1. No comments yet.
(will not be published)
  1. No trackbacks yet.