tidy::parseFile
(PHP 5, PHP 7, PECL tidy >= 0.5.2)
tidy :: parseFile - tidy_parse_file - 解析文件或URI中的标记
描述
面向对象的风格
bool tidy::parseFile ( string $filename [, mixed $config [, string $encoding [, bool $use_include_path = false ]]] )
程序风格
tidy tidy_parse_file ( string $filename [, mixed $config [, string $encoding [, bool $use_include_path = false ]]] )
解析给定的文件。
参数
filename
如果filename
给出参数,则此函数也将读取该文件并使用该文件初始化对象,类似于tidy_parse_file()。
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中搜索文件。
返回值
TRUE
成功或FALSE
失败时返回。
例子
Example #1 tidy::parseFile() example
<?php
$tidy = new tidy();
$tidy->parseFile('file.html');
$tidy->cleanRepair();
if(!empty($tidy->errorBuffer)) {
echo "The following errors or warnings occurred:\n";
echo $tidy->errorBuffer;
}
?>
注意
注意:可选参数
config
并encoding
添加到Tidy 2.0中。
← tidy::isXml
tidy::parseString →
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com