Forum und email

tidy_parse_file

(PHP 5, PECL tidy:0.5.2-1.2)

tidy_parse_file — Parse markup in file or URI

Description

Procedural style:

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

Object oriented style:

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

This function parses the given file.

config 인수는 배열이나 문자열을 전달할 수 있습니다. 문자열을 넘기면, 설정 파일의 이름을 의미합니다. 그 외에는 옵션 자체로 해석합니다. 각 옵션의 설명은 » https://tidy.sourceforge.net/docs/quickref.html를 확인하십시오. encoding 인수는 입출력 문서의 인코딩을 지정합니다. 가능한 encoding 값은: ascii, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16, utf16le, utf16be, big5, shiftjis.

Example#1 tidy_parse_file() example

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

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

Note: The optional parameters config and encoding were added in Tidy 2.0.

See also tidy_parse_string(), tidy_repair_file() and tidy_repair_string().