HTML整洁

function html_tidy( $input_html, $indent = "true", $no_body_tags = "true", $fix = "true" ) {
   ob_start(  );
   $tidy = new tidy;
   $config = array( 'indent' => $indent, 'output-xhtml' => true, 'wrap' => 200, 'clean' => $fix, 'show-body-only' => $no_body_tags );
   $tidy->parseString( $input_html, $config, 'utf8' );
   $tidy->cleanRepair(  );
   $input = $tidy;
   return $input;
}

翻译自: https://css-tricks.com/snippets/php/html-tidy/

你可能感兴趣的:(php,java,js,leetcode,html)