Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update filter #957

Merged
merged 8 commits into from
Dec 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update filter-input.xml
  • Loading branch information
mowangjuanzi authored Dec 26, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 2c712827987e2f4eff94c41e20b81b14c522a8a0
102 changes: 54 additions & 48 deletions reference/filter/functions/filter-input.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 6e4ac10da6c9456f413316677a29d5296bdc5fb4 Maintainer: mowangjuanzi Status: ready -->
<!-- EN-Revision: 53054bf8decc8648cf2e90a493692a161e2371af Maintainer: mowangjuanzi Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<!-- Generated by xml_proto.php v2.4. Found in /scripts directory of phpdoc. -->
<refentry xml:id="function.filter-input" xmlns="http://docbook.org/ns/docbook">
<refentry xml:id="function.filter-input" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<refnamediv>
<refnamediv>
<refname>filter_input</refname>
<refpurpose>通过名称获取特定的外部变量,并且可以通过过滤器处理它</refpurpose>
@@ -17,55 +17,56 @@
<methodparam choice="opt"><type>int</type><parameter>filter</parameter><initializer><constant>FILTER_DEFAULT</constant></initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>array</type><type>int</type></type><parameter>options</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>

</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<para>
<constant>INPUT_GET</constant>, <constant>INPUT_POST</constant>,
<constant>INPUT_COOKIE</constant>, <constant>INPUT_SERVER</constant>或
<constant>INPUT_ENV</constant>之一。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>var_name</parameter></term>
<listitem>
<para>
待获取的变量名。
</para>
</listitem>
</varlistentry>
&filter.param.filter;
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
一个选项的关联数组,或者按位区分的标示。如果过滤器接受选项,可以通过数组的 "flags" 位去提供这些标示。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<variablelist>
<varlistentry>
<term><parameter>type</parameter></term>
<listitem>
<simpara>
<constant>INPUT_<replaceable>*</replaceable></constant> 常量之一。
</simpara>
<warning>
<simpara>
正在过滤的超全局变量的内容是 <acronym>SAPI</acronym>
提供的原始“原始”内容,在用户对超全局变量进行任何修改之前。要过滤修改后的超全局变量,请使用
<function>filter_var</function>。
</simpara>
</warning>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>var_name</parameter></term>
<listitem>
<simpara>
在相应 <parameter>type</parameter> 的超全局变量中要过滤的变量名称。
</simpara>
</listitem>
</varlistentry>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.filter-var')/db:refsect1[@role='parameters']//db:varlistentry[db:term[db:parameter[text()='filter']]]/.)">
<xi:fallback/>
</xi:include>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.filter-var')/db:refsect1[@role='parameters']//db:varlistentry[db:term[db:parameter[text()='options']]]/.)">
<xi:fallback/>
</xi:include>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
如果成功的话返回所请求的变量。如果过滤失败则返回 &false;,如果<parameter>var_name</parameter> 不存在的话则返回
&null;。如果标示 <constant>FILTER_NULL_ON_FAILURE</constant> 被使用了,那么当变量不存在时返回 &false;,当过滤失败时返回 &null;。
</para>
<simpara>
成功时返回过滤后的变量。如果变量未设置,则返回 &false;。失败时返回 &false;,除非使用
<constant>FILTER_NULL_ON_FAILURE</constant> flag,在这种情况下返回 &null;。
</simpara>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>一个 <function>filter_input</function> 的例子</title>
<title><function>filter_input</function> 示例</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -89,14 +90,19 @@ You have searched for Me &#38; son.

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>filter_var</function></member>
<member><function>filter_input_array</function></member>
<member><function>filter_var_array</function></member>
<member><xref linkend="filter.filters"/></member>
</simplelist>
</para>
<simplelist>
<member><function>filter_input_array</function></member>
<member><function>filter_var</function></member>
<member><function>filter_var_array</function></member>
<member>
验证过滤器
<constant>FILTER_VALIDATE_<replaceable>*</replaceable></constant>
</member>
<member>
清理过滤器
<constant>FILTER_SANITIZE_<replaceable>*</replaceable></constant>
</member>
</simplelist>
</refsect1>

</refentry>
Loading