Forum und email
tidy_repair_file

tidy_repair_file

(PHP 5)

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.

Parametr config lze předávat jak jako pole, tak jako řetězec. Předává-li se jako řetězec, představuje název konfiguračního souboru, jinak jsou obsažené parametry přímo interpretovány. Vysvětlení všech voleb naleznete na https://tidy.sourceforge.net/docs/quickref.html

Parametr encoding nastavuje kódování pro vstupní/výstupní dokumenty. Možné hodnoty parametru encoding jsou: ascii, latin0, latin1, raw, utf8, iso202, utf16le, utf16be, utf16, mac, win1252, ibm858, big5 a shiftjis.

Příklad 1. tidy_repair_file() example

<?php
$file
= 'file.html';

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

file_put_contents($file, $repaired);
?>

Poznámka: Ve verzi Tidy 2.0 byly přidány nepovinné parametry config_options a enconding.

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