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 eventbuffer linearizes data within buffer and returns it s contents as a stringphp 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 firebird/interbase 函数 create blob copy file in it and close itphp ncurses 函数 apply padding information to the string and output itphp parsekit 函数 compile a php file and return the resulting op arrayphp parsekit 函数 compile a string of php code and return the resulting op arrayphp svn 函数 return true if the path points to a file false otherwisephp 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 sdo das xml 函数 creates an xml document object from scratch without the need to load a document from a file or stringphp simplexmlelement return a well formed xml string based on simplexml elementphp tidy repair a file and return it as a stringphp tidy repair a string using an optionally provided configuration file
关注编程学问公众号