Forum und email

tidy_repair_file

(PHP 5, PECL tidy:0.7-1.2)

tidy_repair_file — Repair a file and return it as a string

Description

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

This function repairs the given file and returns it as a string.

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_repair_file() example

<?php
$file 
'file.html';

$repaired tidy_repair_file($file);
rename($file$file '.bak');

file_put_contents($file$repaired);
?>

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

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