PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<tidy_parse_stringtidy_repair_string>
Last updated: Mon, 16 Jul 2012

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.

config 参数可以以数组或者字符串方式传递。如果以字符串传递,则代表配置文件名,否则就解释为选项本身。每个选项的解释见 http://tidy.sourceforge.net/docs/quickref.html

encoding 参数设置了输入/输出文档的编码方式。encoding 的可能值有:ascii,latin0,latin1,raw,utf8,iso2022,mac,win1252,ibm858,utf16,utf16le,utf16be,big5 和 shiftjis。

例子 1. tidy_repair_file() example

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

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

file_put_contents($file, $repaired);
?>

注: 可选参数 configencoding 是在 Tidy 2.0 中新加的。

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




<tidy_parse_stringtidy_repair_string>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST