⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intro.filter.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Introduction</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="book.filter.html">Filter</a></div> <div class="next" style="text-align: right; float: right;"><a href="filter.setup.html">Installing/Configuring</a></div> <div class="up"><a href="book.filter.html">Filter</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="intro.filter" class="preface">   <h1 class="title">Introduction</h1>   <p class="para">    This extension serves to validate and filter data coming from some insecure    source, such as user input.   </p>   <p class="para">    The following filters currently exist; be sure to read the     <a href="filter.constants.html" class="link">Filter Constants</a> section     for information that describes the behavior of each constant:    <table border="5">     <caption><b>Existing filters</b></caption>     <colgroup>      <thead valign="middle">       <tr valign="middle">        <th colspan="1">ID</th>        <th colspan="1">Name</th>        <th colspan="1">Options</th>        <th colspan="1">Flags</th>        <th colspan="1">Description</th>       </tr>      </thead>      <tbody valign="middle" class="tbody">       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_VALIDATE_INT</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;int&quot;</td>        <td colspan="1" rowspan="1" align="left">         <i><tt class="parameter">min_range</tt></i>,         <i><tt class="parameter">max_range</tt></i>        </td>        <td colspan="1" rowspan="1" align="left">         <b><tt>FILTER_FLAG_ALLOW_OCTAL</tt></b>,         <b><tt>FILTER_FLAG_ALLOW_HEX</tt></b>        </td>        <td colspan="1" rowspan="1" align="left">Validates value as integer, optionally from the specified range.</td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_VALIDATE_BOOLEAN</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;boolean&quot;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">          <b><tt>FILTER_NULL_ON_FAILURE</tt></b>        </td>        <td colspan="1" rowspan="1" align="left">         <p class="para">          Returns <b><tt>TRUE</tt></b> for &quot;1&quot;, &quot;true&quot;, &quot;on&quot; and &quot;yes&quot;.          Returns <b><tt>FALSE</tt></b> otherwise.         </p>         <p class="para">          If <b><tt>FILTER_NULL_ON_FAILURE</tt></b> is set, <b><tt>FALSE</tt></b> is          returned only for &quot;0&quot;, &quot;false&quot;, &quot;off&quot;, &quot;no&quot;, and &quot;&quot;, and          <b><tt>NULL</tt></b> is returned for all non-boolean values.         </p>        </td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_VALIDATE_FLOAT</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;float&quot;</td>        <td colspan="1" rowspan="1" align="left">         <i><tt class="parameter">decimal</tt></i>        </td>        <td colspan="1" rowspan="1" align="left">         <b><tt>FILTER_FLAG_ALLOW_THOUSAND</tt></b>        </td>        <td colspan="1" rowspan="1" align="left">Validates value as float.</td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_VALIDATE_REGEXP</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;validate_regexp&quot;</td>        <td colspan="1" rowspan="1" align="left">         <i><tt class="parameter">regexp</tt></i>        </td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">         Validates value against <i><tt class="parameter">regexp</tt></i>, a         <a href="book.pcre.html" class="link">Perl-compatible</a> regular expression.        </td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_VALIDATE_URL</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;validate_url&quot;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">         <b><tt>FILTER_FLAG_PATH_REQUIRED</tt></b>,         <b><tt>FILTER_FLAG_QUERY_REQUIRED</tt></b>        </td>        <td colspan="1" rowspan="1" align="left">Validates value as URL, optionally with required components.</td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_VALIDATE_EMAIL</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;validate_email&quot;</td>        <td class="empty">&nbsp;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">Validates value as e-mail.</td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_VALIDATE_IP</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;validate_ip&quot;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">         <b><tt>FILTER_FLAG_IPV4</tt></b>,         <b><tt>FILTER_FLAG_IPV6</tt></b>,         <b><tt>FILTER_FLAG_NO_PRIV_RANGE</tt></b>,         <b><tt>FILTER_FLAG_NO_RES_RANGE</tt></b>        </td>        <td colspan="1" rowspan="1" align="left">         Validates value as IP address, optionally only IPv4 or IPv6 or not         from private or reserved ranges.        </td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_SANITIZE_STRING</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;string&quot;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">         <b><tt>FILTER_FLAG_NO_ENCODE_QUOTES</tt></b>,         <b><tt>FILTER_FLAG_STRIP_LOW</tt></b>,         <b><tt>FILTER_FLAG_STRIP_HIGH</tt></b>,         <b><tt>FILTER_FLAG_ENCODE_LOW</tt></b>,         <b><tt>FILTER_FLAG_ENCODE_HIGH</tt></b>,         <b><tt>FILTER_FLAG_ENCODE_AMP</tt></b>        </td>        <td colspan="1" rowspan="1" align="left">Strip tags, optionally strip or encode special characters.</td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_SANITIZE_STRIPPED</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;stripped&quot;</td>        <td class="empty">&nbsp;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">Alias of &quot;string&quot; filter.</td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_SANITIZE_ENCODED</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;encoded&quot;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">         <b><tt>FILTER_FLAG_STRIP_LOW</tt></b>,         <b><tt>FILTER_FLAG_STRIP_HIGH</tt></b>,         <b><tt>FILTER_FLAG_ENCODE_LOW</tt></b>,         <b><tt>FILTER_FLAG_ENCODE_HIGH</tt></b>        </td>        <td colspan="1" rowspan="1" align="left">URL-encode string, optionally strip or encode special characters.</td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_SANITIZE_SPECIAL_CHARS</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;special_chars&quot;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">         <b><tt>FILTER_FLAG_STRIP_LOW</tt></b>,         <b><tt>FILTER_FLAG_STRIP_HIGH</tt></b>,         <b><tt>FILTER_FLAG_ENCODE_HIGH</tt></b>        </td>        <td colspan="1" rowspan="1" align="left">         HTML-escape <i>&#039;&quot;&lt;&gt;&amp;</i> and characters with         ASCII value less than 32, optionally strip or encode other special         characters.        </td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_UNSAFE_RAW</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;unsafe_raw&quot;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">         <b><tt>FILTER_FLAG_STRIP_LOW</tt></b>,         <b><tt>FILTER_FLAG_STRIP_HIGH</tt></b>,         <b><tt>FILTER_FLAG_ENCODE_LOW</tt></b>,         <b><tt>FILTER_FLAG_ENCODE_HIGH</tt></b>,         <b><tt>FILTER_FLAG_ENCODE_AMP</tt></b>        </td>        <td colspan="1" rowspan="1" align="left">Do nothing, optionally strip or encode special characters.</td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_SANITIZE_EMAIL</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;email&quot;</td>        <td class="empty">&nbsp;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">         Remove all characters except letters, digits and         <i>!#$%&amp;&#039;*+-/=?^_`{|}~@.[]</i>.        </td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_SANITIZE_URL</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;url&quot;</td>        <td class="empty">&nbsp;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">         Remove all characters except letters, digits and         <i>$-_.+!*&#039;(),{}|\\^~[]`&lt;&gt;#%&quot;;/?:@&amp;=</i>.        </td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_SANITIZE_NUMBER_INT</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;number_int&quot;</td>        <td class="empty">&nbsp;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">         Remove all characters except digits, plus and minus sign.        </td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_SANITIZE_NUMBER_FLOAT</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;number_float&quot;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">         <b><tt>FILTER_FLAG_ALLOW_FRACTION</tt></b>,         <b><tt>FILTER_FLAG_ALLOW_THOUSAND</tt></b>,         <b><tt>FILTER_FLAG_ALLOW_SCIENTIFIC</tt></b>        </td>        <td colspan="1" rowspan="1" align="left">         Remove all characters except digits, <i>+-</i> and         optionally <i>.,eE</i>.        </td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_SANITIZE_MAGIC_QUOTES</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;magic_quotes&quot;</td>        <td class="empty">&nbsp;</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">Apply <a href="function.addslashes.html" class="function">addslashes()</a>.</td>       </tr>       <tr valign="middle">        <td colspan="1" rowspan="1" align="left"><b><tt>FILTER_CALLBACK</tt></b></td>        <td colspan="1" rowspan="1" align="left">&quot;callback&quot;</td>        <td colspan="1" rowspan="1" align="left"><a href="language.pseudo-types.html#language.types.callback" class="type callback">callback</a> function or method</td>        <td class="empty">&nbsp;</td>        <td colspan="1" rowspan="1" align="left">Call user-defined function to filter data.</td>       </tr>      </tbody>     </colgroup>    </table>   </p> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="book.filter.html">Filter</a></div> <div class="next" style="text-align: right; float: right;"><a href="filter.setup.html">Installing/Configuring</a></div> <div class="up"><a href="book.filter.html">Filter</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 + -