<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.taint.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.untaint.php',
    1 => 'untaint',
    2 => '清除字符串上的污点标记',
  ),
  'up' => 
  array (
    0 => 'ref.taint.php',
    1 => 'Taint 函数',
  ),
  'prev' => 
  array (
    0 => 'function.taint.php',
    1 => 'taint',
  ),
  'next' => 
  array (
    0 => 'book.ds.php',
    1 => 'Data Structures',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/taint/functions/untaint.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.untaint" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">untaint</h1>
  <p class="verinfo">(PECL taint &gt;=0.1.0)</p><p class="refpurpose"><span class="refname">untaint</span> &mdash; <span class="dc-title">清除字符串上的污点标记</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.untaint-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">function</span> <span class="methodname"><strong>untaint</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter reference">&$string</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter reference">&...$strings</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="simpara">
   清除指定字符串上的污点标记。
  </p>
  <p class="simpara">
   标记存储于字符串本身而非变量之上，因此一次调用即可同时清除
   所有共享同一字符串的变量上的标记。可用它来为已经自行校验过的值
   放行，例如在严格的白名单检查之后。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.untaint-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">string</code></dt>
    <dd>
     <p class="simpara">
      持有待清除标记的字符串的变量。
     </p>
    </dd>
   
   
    <dt><code class="parameter">strings</code></dt>
    <dd>
     <p class="simpara">
      更多待清除标记的变量。
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.untaint-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="simpara">
   始终返回 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>。当
   <a href="taint.configuration.php#ini.taint.enable" class="link">taint.enable</a> 未开启时，
   该函数不做任何事，但仍然返回 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.untaint-examples">
  <h3 class="title">示例</h3>
  <div class="example" id="example-1">
   <p><strong>示例 #1 <span class="function"><strong>untaint()</strong></span> 示例</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
$id </span><span style="color: #007700">= </span><span style="color: #DD0000">"42"</span><span style="color: #007700">;
</span><span style="color: #0000BB">taint</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">);
if (</span><span style="color: #0000BB">preg_match</span><span style="color: #007700">(</span><span style="color: #DD0000">'/^\d+$/'</span><span style="color: #007700">, </span><span style="color: #0000BB">$id</span><span style="color: #007700">)) {
    </span><span style="color: #FF8000">// strictly validated as digits: safe to trust
    </span><span style="color: #0000BB">untaint</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">);
}
</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">is_tainted</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">));
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
   </div>

   <div class="example-contents"><p>以上示例的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">bool(false)</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 notes" id="refsect1-function.untaint-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="simpara">
    只有字符串能携带标记；传入非字符串值时不做任何事。
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.untaint-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.taint.php" class="function" rel="rdfs-seeAlso">taint()</a> - 将字符串标记为已污染</span></li>
    <li><span class="function"><a href="function.is-tainted.php" class="function" rel="rdfs-seeAlso">is_tainted()</a> - 检查一个字符串是否被污染</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>