(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.7.0)
tidy::repairFile -- tidy_repair_file — ファイルを修正し、それを文字列として返す
オブジェクト指向型
$filename,$config = null,$encoding = null,$useIncludePath = false手続き型
$filename,$config = null,$encoding = null,$useIncludePath = false与えられたファイルを修正し、それを文字列として返します。
filename修正するファイル。
config
       config には配列あるいは文字列を渡します。
       文字列を渡した場合は設定ファイルの名前、
       それ以外の場合は設定そのものとして解釈されます。
      
オプションについての説明は http://tidy.sourceforge.net/docs/quickref.html を参照ください。
encoding
       encoding は入出力ドキュメントのエンコーディングを設定します。
       指定できるエンコーディング名は
       ascii、latin0、latin1、
       raw、utf8、iso2022、
       mac、win1252、ibm858、
       utf16、utf16le、utf16be、
       big5 および shiftjis です。
      
useIncludePathinclude_path からファイルを探します。
修正した内容を文字列で返します。
例1 tidy::repairFile() の例
<?php
$file = 'file.html';
$tidy = new tidy();
$repaired = $tidy->repairfile($file);
rename($file, $file . '.bak');
file_put_contents($file, $repaired);
?>