downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Tidy> <
Last updated: Fri, 13 Nov 2009

view this page in

このシンプルな例は、Tidy の基本的な使い方を示しています。

例1 Tidy の基本的な使用法

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

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

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

// 出力
echo $tidy;
?>



add a note add a note User Contributed Notes
Brad
03-Mar-2009 08:50
Cleaning an html fragment (OO support seems to half-arsed for now)

This will ensure all tags are closed, without adding any html/head/body tags around it.

<?php
$tidy_config
= array(
                    
'clean' => true,
                    
'output-xhtml' => true,
                    
'show-body-only' => true,
                    
'wrap' => 0,
                    
                     );

$tidy = tidy_parse_string($html_fragment, $tidy_config, 'UTF8');
$tidy->cleanRepair();
echo
$tidy;
?>

Tidy> <
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites