tidy::repairFile
(PHP 5, PHP 7, PECL tidy >= 0.7.0)
tidy :: repairFile - tidy_repair_file - 修复文件并将其作为字符串返回
描述
面向对象的风格
string 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 ]]] )
修复给定的文件并将其作为字符串返回。
参数
filename
要修复的文件。
config
配置config
可以作为数组或字符串传递。如果传递一个字符串,它将被解释为配置文件的名称,否则它会被解释为选项本身。
查看http://tidy.sourceforge.net/docs/quickref.html获取关于每个选项的解释。
encoding
该encoding
参数设置输入/输出文档的编码。用于编码的可能值是:ASCII,latin0,latin1的,原料,UTF8,ISO2022,MAC,win1252,ibm858,UTF16,utf16le应按,utf16be应按,中文,和SHIFTJIS。
use_include_path
在include_path中搜索文件。
返回值
以字符串形式返回修复的内容。
例子
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);
?>
注意
注意:可选参数
config
并encoding
添加到Tidy 2.0中。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com