1 | <HTML
|
---|
2 | ><HEAD
|
---|
3 | ><TITLE
|
---|
4 | >Overview</TITLE
|
---|
5 | ><META
|
---|
6 | NAME="GENERATOR"
|
---|
7 | CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
---|
8 | REL="HOME"
|
---|
9 | TITLE="Manuál PHP"
|
---|
10 | HREF="index.html"><LINK
|
---|
11 | REL="UP"
|
---|
12 | TITLE="Extending PHP 4.0"
|
---|
13 | HREF="zend.html"><LINK
|
---|
14 | REL="PREVIOUS"
|
---|
15 | TITLE="Extending PHP 4.0"
|
---|
16 | HREF="zend.html"><LINK
|
---|
17 | REL="NEXT"
|
---|
18 | TITLE="Extension Possibilities"
|
---|
19 | HREF="zend.possibilities.html"><META
|
---|
20 | HTTP-EQUIV="Content-type"
|
---|
21 | CONTENT="text/html; charset=ISO-8859-2"></HEAD
|
---|
22 | ><BODY
|
---|
23 | CLASS="chapter"
|
---|
24 | BGCOLOR="#FFFFFF"
|
---|
25 | TEXT="#000000"
|
---|
26 | LINK="#0000FF"
|
---|
27 | VLINK="#840084"
|
---|
28 | ALINK="#0000FF"
|
---|
29 | ><DIV
|
---|
30 | CLASS="NAVHEADER"
|
---|
31 | ><TABLE
|
---|
32 | SUMMARY="Header navigation table"
|
---|
33 | WIDTH="100%"
|
---|
34 | BORDER="0"
|
---|
35 | CELLPADDING="0"
|
---|
36 | CELLSPACING="0"
|
---|
37 | ><TR
|
---|
38 | ><TH
|
---|
39 | COLSPAN="3"
|
---|
40 | ALIGN="center"
|
---|
41 | >Manuál PHP</TH
|
---|
42 | ></TR
|
---|
43 | ><TR
|
---|
44 | ><TD
|
---|
45 | WIDTH="10%"
|
---|
46 | ALIGN="left"
|
---|
47 | VALIGN="bottom"
|
---|
48 | ><A
|
---|
49 | HREF="zend.html"
|
---|
50 | ACCESSKEY="P"
|
---|
51 | >Pøedcházející</A
|
---|
52 | ></TD
|
---|
53 | ><TD
|
---|
54 | WIDTH="80%"
|
---|
55 | ALIGN="center"
|
---|
56 | VALIGN="bottom"
|
---|
57 | ></TD
|
---|
58 | ><TD
|
---|
59 | WIDTH="10%"
|
---|
60 | ALIGN="right"
|
---|
61 | VALIGN="bottom"
|
---|
62 | ><A
|
---|
63 | HREF="zend.possibilities.html"
|
---|
64 | ACCESSKEY="N"
|
---|
65 | >Dal¹í</A
|
---|
66 | ></TD
|
---|
67 | ></TR
|
---|
68 | ></TABLE
|
---|
69 | ><HR
|
---|
70 | ALIGN="LEFT"
|
---|
71 | WIDTH="100%"></DIV
|
---|
72 | ><DIV
|
---|
73 | CLASS="chapter"
|
---|
74 | ><H1
|
---|
75 | ><A
|
---|
76 | NAME="zend.overview"
|
---|
77 | >Kapitola 24. Overview</A
|
---|
78 | ></H1
|
---|
79 | ><DIV
|
---|
80 | CLASS="TOC"
|
---|
81 | ><DL
|
---|
82 | ><DT
|
---|
83 | ><B
|
---|
84 | >Obsah</B
|
---|
85 | ></DT
|
---|
86 | ><DT
|
---|
87 | ><A
|
---|
88 | HREF="zend.overview.html#zend.overview.whatisit"
|
---|
89 | >What Is Zend? and What Is PHP?</A
|
---|
90 | ></DT
|
---|
91 | ></DL
|
---|
92 | ></DIV
|
---|
93 | ><P
|
---|
94 | > "Extending PHP" is easier said than done. PHP has evolved to a
|
---|
95 | full-fledged tool consisting of a few megabytes of source code,
|
---|
96 | and to hack a system like this quite a few things have to be
|
---|
97 | learned and considered. When structuring this chapter, we finally
|
---|
98 | decided on the "learn by doing" approach. This is not the most
|
---|
99 | scientific and professional approach, but the method that's the
|
---|
100 | most fun and gives the best end results. In the following
|
---|
101 | sections, you'll learn quickly how to get the most basic
|
---|
102 | extensions to work almost instantly. After that, you'll learn
|
---|
103 | about Zend's advanced API functionality. The alternative would
|
---|
104 | have been to try to impart the functionality, design, tips,
|
---|
105 | tricks, etc. as a whole, all at once, thus giving a complete look
|
---|
106 | at the big picture before doing anything practical. Although this
|
---|
107 | is the "better" method, as no dirty hacks have to be made, it can
|
---|
108 | be very frustrating as well as energy- and time-consuming, which
|
---|
109 | is why we've decided on the direct approach.
|
---|
110 | </P
|
---|
111 | ><P
|
---|
112 | > Note that even though this chapter tries to impart as much
|
---|
113 | knowledge as possible about the inner workings of PHP, it's
|
---|
114 | impossible to really give a complete guide to extending PHP that
|
---|
115 | works 100% of the time in all cases. PHP is such a huge and
|
---|
116 | complex package that its inner workings can only be understood if
|
---|
117 | you make yourself familiar with it by practicing, so we encourage
|
---|
118 | you to work with the source.
|
---|
119 | </P
|
---|
120 | ><DIV
|
---|
121 | CLASS="section"
|
---|
122 | ><H1
|
---|
123 | CLASS="section"
|
---|
124 | ><A
|
---|
125 | NAME="zend.overview.whatisit"
|
---|
126 | ></A
|
---|
127 | >What Is Zend? and What Is PHP?</H1
|
---|
128 | ><P
|
---|
129 | > The name <SPAN
|
---|
130 | CLASS="emphasis"
|
---|
131 | ><I
|
---|
132 | CLASS="emphasis"
|
---|
133 | >Zend</I
|
---|
134 | ></SPAN
|
---|
135 | > refers to the language engine,
|
---|
136 | PHP's core. The term <SPAN
|
---|
137 | CLASS="emphasis"
|
---|
138 | ><I
|
---|
139 | CLASS="emphasis"
|
---|
140 | >PHP</I
|
---|
141 | ></SPAN
|
---|
142 | > refers to the
|
---|
143 | complete system as it appears from the outside. This might sound
|
---|
144 | a bit confusing at first, but it's not that complicated (see
|
---|
145 | <A
|
---|
146 | HREF="zend.overview.html#fig.internal-struct"
|
---|
147 | >24-1</A
|
---|
148 | >). To implement a Web script interpreter, you need
|
---|
149 | three parts:
|
---|
150 | <P
|
---|
151 | ></P
|
---|
152 | ><OL
|
---|
153 | TYPE="1"
|
---|
154 | ><LI
|
---|
155 | ><P
|
---|
156 | > The <SPAN
|
---|
157 | CLASS="emphasis"
|
---|
158 | ><I
|
---|
159 | CLASS="emphasis"
|
---|
160 | >interpreter</I
|
---|
161 | ></SPAN
|
---|
162 | > part analyzes the input
|
---|
163 | code, translates it, and executes it.
|
---|
164 | </P
|
---|
165 | ></LI
|
---|
166 | ><LI
|
---|
167 | ><P
|
---|
168 | > The <SPAN
|
---|
169 | CLASS="emphasis"
|
---|
170 | ><I
|
---|
171 | CLASS="emphasis"
|
---|
172 | >functionality</I
|
---|
173 | ></SPAN
|
---|
174 | > part implements the
|
---|
175 | functionality of the language (its functions, etc.).
|
---|
176 | </P
|
---|
177 | ></LI
|
---|
178 | ><LI
|
---|
179 | ><P
|
---|
180 | > The <SPAN
|
---|
181 | CLASS="emphasis"
|
---|
182 | ><I
|
---|
183 | CLASS="emphasis"
|
---|
184 | >interface</I
|
---|
185 | ></SPAN
|
---|
186 | > part talks to the Web
|
---|
187 | server, etc.
|
---|
188 | </P
|
---|
189 | ></LI
|
---|
190 | ></OL
|
---|
191 | >
|
---|
192 | Zend takes part 1 completely and a bit of part 2; PHP takes parts
|
---|
193 | 2 and 3. Together they form the complete PHP package. Zend itself
|
---|
194 | really forms only the language core, implementing PHP at its very
|
---|
195 | basics with some predefined functions. PHP contains all the
|
---|
196 | modules that actually create the language's outstanding
|
---|
197 | capabilities.
|
---|
198 | <DIV
|
---|
199 | CLASS="figure"
|
---|
200 | ><A
|
---|
201 | NAME="fig.internal-struct"
|
---|
202 | ></A
|
---|
203 | ><P
|
---|
204 | ><B
|
---|
205 | >Obrázek 24-1. The internal structure of PHP.</B
|
---|
206 | ></P
|
---|
207 | ><P
|
---|
208 | ><IMG
|
---|
209 | SRC="figures/Extending_Zend_1_PHPs_internal_structure.png"></P
|
---|
210 | ></DIV
|
---|
211 | >
|
---|
212 | </P
|
---|
213 | ><P
|
---|
214 | > The following sections discuss where PHP can be extended and how
|
---|
215 | it's done.
|
---|
216 | </P
|
---|
217 | ></DIV
|
---|
218 | ></DIV
|
---|
219 | ><DIV
|
---|
220 | CLASS="NAVFOOTER"
|
---|
221 | ><HR
|
---|
222 | ALIGN="LEFT"
|
---|
223 | WIDTH="100%"><TABLE
|
---|
224 | SUMMARY="Footer navigation table"
|
---|
225 | WIDTH="100%"
|
---|
226 | BORDER="0"
|
---|
227 | CELLPADDING="0"
|
---|
228 | CELLSPACING="0"
|
---|
229 | ><TR
|
---|
230 | ><TD
|
---|
231 | WIDTH="33%"
|
---|
232 | ALIGN="left"
|
---|
233 | VALIGN="top"
|
---|
234 | ><A
|
---|
235 | HREF="zend.html"
|
---|
236 | ACCESSKEY="P"
|
---|
237 | >Pøedcházející</A
|
---|
238 | ></TD
|
---|
239 | ><TD
|
---|
240 | WIDTH="34%"
|
---|
241 | ALIGN="center"
|
---|
242 | VALIGN="top"
|
---|
243 | ><A
|
---|
244 | HREF="index.html"
|
---|
245 | ACCESSKEY="H"
|
---|
246 | >Domù</A
|
---|
247 | ></TD
|
---|
248 | ><TD
|
---|
249 | WIDTH="33%"
|
---|
250 | ALIGN="right"
|
---|
251 | VALIGN="top"
|
---|
252 | ><A
|
---|
253 | HREF="zend.possibilities.html"
|
---|
254 | ACCESSKEY="N"
|
---|
255 | >Dal¹í</A
|
---|
256 | ></TD
|
---|
257 | ></TR
|
---|
258 | ><TR
|
---|
259 | ><TD
|
---|
260 | WIDTH="33%"
|
---|
261 | ALIGN="left"
|
---|
262 | VALIGN="top"
|
---|
263 | >Extending PHP 4.0</TD
|
---|
264 | ><TD
|
---|
265 | WIDTH="34%"
|
---|
266 | ALIGN="center"
|
---|
267 | VALIGN="top"
|
---|
268 | ><A
|
---|
269 | HREF="zend.html"
|
---|
270 | ACCESSKEY="U"
|
---|
271 | >Nahoru</A
|
---|
272 | ></TD
|
---|
273 | ><TD
|
---|
274 | WIDTH="33%"
|
---|
275 | ALIGN="right"
|
---|
276 | VALIGN="top"
|
---|
277 | >Extension Possibilities</TD
|
---|
278 | ></TR
|
---|
279 | ></TABLE
|
---|
280 | ></DIV
|
---|
281 | ></BODY
|
---|
282 | ></HTML
|
---|
283 | >
|
---|