function.tidy-getopt.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 71 行
HTML
71 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Returns the value of the specified configuration option for the tidy document</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-get-status.html">tidy_get_status</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.tidy-is-xhtml.html">tidy_is_xhtml</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-getopt" class="refentry"> <div class="refnamediv"> <h1 class="refname">tidy_getopt</h1> <p class="verinfo">(PHP 5, PECL tidy:0.5.2-1.2)</p><p class="refpurpose"><span class="refname">tidy_getopt</span> — <span class="dc-title">Returns the value of the specified configuration option for the tidy document</span></p> </div> <div class="refsect1 unknown"> <h3 class="title">Description</h3> <p class="para">Procedural style:</p> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><b><b>tidy_getopt</b></b></span> ( <span class="methodparam"><span class="type"><span class="type tidy">tidy</span></span> <tt class="parameter">$object</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$option</tt></span> )</div> <p class="para rdfs-comment">Object oriented style:</p> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><b><b>tidy->getOpt</b></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$option</tt></span> )</div> <p class="para rdfs-comment"> <b>tidy_getopt()</b> returns the value of the specified <i><tt class="parameter">option</tt></i> for the specified tidy <i><tt class="parameter">object</tt></i>. The return type depends on the type of the specified <i><tt class="parameter">option</tt></i>. You will find a list with each configuration option and their types at: <a href="http://tidy.sourceforge.net/docs/quickref.html" class="link external">» http://tidy.sourceforge.net/docs/quickref.html</a>. </p> <p class="para"> <div class="example"> <p><b>Example #1 <b>tidy_getopt()</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">=</span><span style="color: #DD0000">'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"><br /><html><head><title>Title</title></head><br /><body><br /><br /><p><img src="img.png"></p><br /><br /></body></html>'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$config </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'accessibility-check' </span><span style="color: #007700">=> </span><span style="color: #0000BB">3</span><span style="color: #007700">,<br /> </span><span style="color: #DD0000">'alt-text' </span><span style="color: #007700">=> </span><span style="color: #DD0000">'some text'</span><span style="color: #007700">);<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">, </span><span style="color: #0000BB">$config</span><span style="color: #007700">);<br /><br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-></span><span style="color: #0000BB">getOpt</span><span style="color: #007700">(</span><span style="color: #DD0000">'accessibility-check'</span><span style="color: #007700">)); </span><span style="color: #FF8000">//integer<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-></span><span style="color: #0000BB">getOpt</span><span style="color: #007700">(</span><span style="color: #DD0000">'lower-literals'</span><span style="color: #007700">)); </span><span style="color: #FF8000">//boolean<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-></span><span style="color: #0000BB">getOpt</span><span style="color: #007700">(</span><span style="color: #DD0000">'alt-text'</span><span style="color: #007700">)); </span><span style="color: #FF8000">//string<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>int(3)bool(true)string(9) "some text"</pre></div> </pre></div> </div> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.tidy-get-status.html">tidy_get_status</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.tidy-is-xhtml.html">tidy_is_xhtml</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 + =
减小字号Ctrl + -
显示快捷键?