Tidy 関数
PHP Manual

tidy_parse_file

(PHP 5, PECL tidy >= 0.5.2)

tidy_parse_fileファイルまたは URI にあるマークアップをパースする

説明

手続き型:

tidy tidy_parse_file ( string $filename [, mixed $config [, string $encoding [, bool $use_include_path= false ]]] )

オブジェクト指向型:

bool tidy->parseFile ( string $filename [, mixed $config [, string $encoding [, bool $use_include_path= false ]]] )

この関数は与えられたファイルをパースします。

config パラメータは、配列または 文字列として指定することができます。文字列として指定した場合には設定ファイルの名前として解釈され、 そうでない場合はオプション自体として解釈されます。各オプションに関する説明については、 » http://tidy.sourceforge.net/docs/quickref.html を参照してください。

encoding パラメータは、文書を入力/出力する際のエンコーディングを 設定します。encoding には次の値を使用可能です。 ascii, latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16, utf16le, utf16be, big5 および shiftjis.

例1 tidy_parse_file() の例

<?php
$tidy 
tidy_parse_file('file.html');

$tidy->cleanRepair();

if(!empty(
$tidy->errorBuffer)) {
    echo 
"The following errors or warnings occured:\n";
    echo 
$tidy->errorBuffer;
}
?>

注意: オプションのパラメータ config_optionsenconding は Tidy 2.0 で追加されました。

tidy_parse_string(), tidy_repair_file(), tidy_repair_string() も参照ください。


Tidy 関数
PHP Manual
アダルトレンタルサーバー