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

tidy_repair_string

(PHP 5)

tidy_repair_string --  Repair a string using an optionally provided configuration file

Description

string tidy_repair_string ( string data [, mixed config [, string encoding]] )

This function repairs the given 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_string() example

<?php
ob_start
();
?>

<html>
  <head>
   <title>test</title>
  </head>
  <body>
   <p>error</i>
  </body>
</html>

<?php

$buffer
= ob_get_clean();
$tidy = tidy_repair_string($buffer);

echo
$tidy;
?>

上例将输出:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>test</title>
</head>
<body>
<p>error</p>
</body>
</html>

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

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




<tidy_repair_filetidy_reset_config>
 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