tidy::repairFile

tidy_repair_file

(PHP 5, PHP 7, PECL tidy >= 0.7.0)

tidy::repairFile -- tidy_repair_fileRepair a file and return it as a string

说明

面向对象风格

public tidy::repairFile ( string $filename [, mixed $config [, string $encoding [, bool $use_include_path = FALSE ]]] ) : string

过程化风格

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

Repairs the given file and returns it as a string.

参数

filename

The file to be repaired.

config

The config config can be passed either as an array or as a string. If a string is passed, it is interpreted as the name of the configuration file, otherwise, it is interpreted as the options themselves.

Check http://tidy.sourceforge.net/docs/quickref.html for an explanation about each option.

encoding

The encoding parameter sets the encoding for input/output documents. The possible values for encoding are: ascii, latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16, utf16le, utf16be, big5, and shiftjis.

use_include_path

Search for the file in the include_path.

返回值

Returns the repaired contents as a string.

范例

Example #1 tidy::repairFile() example

<?php
$file 
'file.html';

$tidy = new tidy();
$repaired $tidy->repairfile($file);
rename($file$file '.bak');

file_put_contents($file$repaired);
?>

参见

相关文章
php cachingiterator return the string representation of the current elementphp directoryiterator return file name of current directoryiterator itemphp cubrid mysql 兼容性函数 fetch the next row and return it as an objectphp dbx 函数 escape a string so it can safely be used in an sql statementphp direct io 函数 opens a file creating it if necessary at a lower level than the c library input/ouput stream functions allowphp eio 函数 delete a name and possibly the file it refers tophp firebird/interbase 函数 create blob copy file in it and close itphp ncurses 函数 apply padding information to the string and output itphp socket 函数 return a string describing a socket errorphp tidy 函数 return a string representing the parsed tidy markupphp mnogosearch 函数 return hash32 checksum of given stringphp mongocollection update a document and return itphp mongogridfscursor return the next file to which this cursor points and advance the cursorphp mongogridfsfile returns this file s contents as a string of bytesphp phardata set the contents of a file within the tar/zip to those of an external file or stringphp simplexmlelement return a well formed xml string based on simplexml elementphp swoole buffer append the string or binary data at the end of the memory buffer and return the new size of memory allocated.php tidy execute configured cleanup and repair operations on parsed markupphp tidy repair a file and return it as a stringphp tidy repair a string using an optionally provided configuration file
关注编程学问公众号