📄 function.tidy-construct.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Constructs a new tidy object</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.tidy-config-count.html">tidy_config_count</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.tidy-diagnose.html">tidy_diagnose</a></div> <div class="up"><a href="ref.tidy.html">Tidy Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.tidy-construct" class="refentry"> <div class="refnamediv"> <h1 class="refname">tidy::__construct</h1> <p class="verinfo">(No version information available, might be only in CVS)</p><p class="refpurpose"><span class="refname">tidy::__construct</span> — <span class="dc-title">Constructs a new tidy object</span></p> </div> <div class="refsect1 unknown"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><span class="type tidy">tidy</span></span> <span class="methodname"><b><b>tidy::__construct</b></b></span> ([ <span class="methodparam"><span class="type">string</span> <tt class="parameter">$filename</tt></span> [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <tt class="parameter">$config</tt></span> [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$encoding</tt></span> [, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$use_include_path</tt></span> ]]]] )</div> <p class="para rdfs-comment"> <b>tidy::__construct()</b> constructs a new tidy object. </p> <p class="para"> If the <i><tt class="parameter">filename</tt></i> parameter is given, this function will also read that file and initialize the object with the file, acting like <a href="function.tidy-parse-file.html" class="function">tidy_parse_file()</a>. </p> <p class="para">The <i><tt class="parameter">config</tt></i> parametercan 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 isinterpreted as the options themselves. Check<a href="http://tidy.sourceforge.net/docs/quickref.html" class="link external">» http://tidy.sourceforge.net/docs/quickref.html</a>for an explanation about each option.</p><p class="para">The<i><tt class="parameter">encoding</tt></i> parameter sets the encoding for input/outputdocuments. The possible values for <i><tt class="parameter">encoding</tt></i> are:<i>ascii</i>, <i>latin0</i>, <i>latin1</i>,<i>raw</i>, <i>utf8</i>, <i>iso2022</i>,<i>mac</i>, <i>win1252</i>, <i>ibm858</i>,<i>utf16</i>, <i>utf16le</i>,<i>utf16be</i>, <i>big5</i> and<i>shiftjis</i>.</p> <p class="para"> <div class="example"> <p><b>Example #1 <b>tidy::__construct()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /><br />$html </span><span style="color: #007700">= <<< HTML<br /></span><span style="color: #0000BB"><br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br /><br /><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><br /><head><title>title</title></head><br /><body><br /><p>paragraph <bt /><br />text</p><br /></body></html><br /><br /></span><span style="color: #007700">HTML;<br /><br /></span><span style="color: #0000BB">$tidy </span><span style="color: #007700">= new </span><span style="color: #0000BB">tidy</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-></span><span style="color: #0000BB">parseString</span><span style="color: #007700">(</span><span style="color: #0000BB">$html</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-></span><span style="color: #0000BB">CleanRepair</span><span style="color: #007700">();<br /><br />if (</span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-></span><span style="color: #0000BB">errorBuffer</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"The following errors were detected:\n"</span><span style="color: #007700">;<br /> echo </span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-></span><span style="color: #0000BB">errorBuffer</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?></span></span></code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents"><pre><div class="cdata"><pre>The following errors were detected:line 8 column 14 - Error: <bt> is not recognized!line 8 column 14 - Warning: discarding unexpected <bt></pre></div> </pre></div> </div> </p> <p class="para"> See also <a href="function.tidy-parse-file.html" class="function">tidy_parse_file()</a> and <a href="function.tidy-parse-string.html" class="function">tidy_parse_string()</a>. </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.tidy-config-count.html">tidy_config_count</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.tidy-diagnose.html">tidy_diagnose</a></div> <div class="up"><a href="ref.tidy.html">Tidy Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -