编程学问
  • 文章
  • 问题
  • 读书
  • 关于
  • 登录
  • « 范例
  • tidy »
  • PHP Manual
  • 范例
  • Tidy example

Tidy example

This simple example shows basic Tidy usage.

Example #1 Basic Tidy usage

<?php
ob_start
();
?>
<html>a html document</html>
<?php
$html 
= ob_get_clean();

// Specify configuration
$config = array(
           
'indent'         => true,
           
'output-xhtml'   => true,
           
'wrap'           => 200);

// Tidy
$tidy = new tidy;
$tidy->parseString($html, $config, 'utf8');
$tidy->cleanRepair();

// Output
echo $tidy;
?>

相关文章
php tidy 函数 ob start callback function to repair the bufferphp tidy 函数 returns the number of tidy warnings encountered for specified documentphp 范例 usage example.php 范例 basic pecl/haru examplephp tidy tidy 函数php 范例 oop pecl/rrd examplephp 范例 procedural pecl/rrd examplephp 范例 example that shows the effect of screamphp 范例 three table examplephp 范例 example class registered as stream wrapperphp tidy 预定义常量php tidy constructs a new tidy objectphp tidy run configured diagnostics on parsed and repaired markupphp 范例 tidy examplephp tidy 范例php tidy parse markup in file or uriphp tidy parse a document stored in a stringphp tidy returns a tidynode object starting from the html tag of the tidy parse treephp tidy return warnings and errors which occurred parsing the specified documentphp tidy repair a file and return it as a string
关注编程学问公众号
编程学问网 湘ICP备20001732号