-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathbook.xml
More file actions
85 lines (81 loc) · 3.41 KB
/
Copy pathbook.xml
File metadata and controls
85 lines (81 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 3d4ee5f40afbfe44db4f1b13a22a6a38d4b40c7b Maintainer: mumumu Status: ready -->
<book xml:id="book.filter" xmlns="http://docbook.org/ns/docbook">
<?phpdoc extension-membership="bundled" ?>
<title>データのフィルタリング</title>
<titleabbrev>フィルタ</titleabbrev>
<preface xml:id="intro.filter">
&reftitle.intro;
<simpara>
この拡張モジュールは、データの検証や除去を行います。
未知の (外部からの) データ、たとえばユーザーの入力などを扱う際に便利です。
<acronym>HTML</acronym> フォームから送られてくるデータなどがこれにあたります。
</simpara>
<simpara>
フィルタリングの方式には、大きく分けて
<emphasis>検証 (validation)</emphasis> と <emphasis>除去 (sanitization)</emphasis>
のふたつがあります。
</simpara>
<simpara>
検証フィルタは、
データが何らかの条件を満たしているかどうかをチェックします。
検証フィルタは、
<constant>FILTER_VALIDATE_<replaceable>*</replaceable></constant>
定数によって識別できます。
たとえば <constant>FILTER_VALIDATE_EMAIL</constant> を渡すと、
データがメールアドレスとして正しい形式かどうかを調べます。
データ自体には何も手を加えません。
</simpara>
<simpara>
一方除去フィルタは、データを"綺麗に"します。
よって、入力データに文字を追加/削除することでデータを変更します。
除去フィルタは、
<constant>FILTER_SANITIZE_<replaceable>*</replaceable></constant>
定数によって識別できます。
たとえば <constant>FILTER_SANITIZE_EMAIL</constant> を渡すと、
メールアドレスとして無効な文字が含まれている場合にそれを除去します。
しかし、除去済みのデータ自体が、
正しいメールアドレスの形式かどうかを調べるわけではありません。
</simpara>
<simpara>
ほとんどのフィルタには、
オプションの <emphasis>フラグ</emphasis> があり、
その振る舞いを細かく調整できるようになっています。
こうしたフラグは、
<constant>FILTER_FLAG_<replaceable>*</replaceable></constant>
定数によって識別できます。
たとえば、検証フィルタ <constant>FILTER_VALIDATE_URL</constant>
と一緒に <constant>FILTER_FLAG_PATH_REQUIRED</constant>
を使うと、<acronym>URL</acronym> に特定のパス
(<literal>http://example.org/foo</literal> における
<literal>/foo</literal> など) を必須とすることができます。
</simpara>
</preface>
&reference.filter.setup;
&reference.filter.constants;
&reference.filter.examples;
&reference.filter.reference;
&reference.filter.filter.filterexception;
&reference.filter.filter.filterfailedexception;
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->