tidy::repairFile
tidy_repair_file
(PHP 5, PECL tidy >= 0.7.0)
tidy::repairFile -- tidy_repair_file — ファイルを修正し、それを文字列として返す
説明
手続き型
string tidy_repair_file
( string $filename
[, mixed $config
[, string $encoding
[, bool $use_include_path = false
]]] )
オブジェクト指向型
string tidy::repairFile
( string $filename
[, mixed $config
[, string $encoding
[, bool $use_include_path = 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 です。
- use_include_path
-
include_path からファイルを探します。
返り値
修正した内容を文字列で返します。
例
例1 tidy::repairFile() の例
<?php
$file = 'file.html';
$tidy = new tidy();
$repaired = $tidy->repairfile($file);
rename($file, $file . '.bak');
file_put_contents($file, $repaired);
?>
注意
注意: オプションのパラメータ config_options と enconding は Tidy 2.0 で追加されました。
参考
- tidy::parseFile() - ファイルまたは URI にあるマークアップをパースする
- tidy::parseString() - 文字列にストアされたドキュメントをパースする
- tidy::repairString() - 別途提供される設定ファイルを使用して文字列を修正する
tidy::repairFile
There are no user contributed notes for this page.
