翻译仅为个人学习,商业版权与此无关!::-- nickcheng [2007-01-25 10:20:05]
Chapter 21. CGI Scripting and Alternatives
When a web browser (or any other web client) requests a page from a web server, the server may return either static or dynamic content. Serving dynamic content involves server-side web programs to generate and deliver content on the fly, often based on information stored in a database. The long-standing web-wide standard for server-side programming is known as CGI, which stands for Common Gateway Interface:
- A web client (typically a browser) sends a structured request to a web server.
- The server executes another program, passing the content of the request.
- The server captures the standard output of the other program.
- The server sends that output to the client as the response to the original request.
In other words, the server's role is that of a gateway between the client and the other program. The other program is called a CGI program, or CGI script.
This chapter assumes familiarity with HTML and HTTP. For reference material on these standards, see Webmaster in a Nutshell, by Stephen Spainhour and Robert Eckstein (O'Reilly). For detailed coverage of HTML, I recommend HTML & XHTML: The Definitive Guide, by Chuck Musciano and Bill Kennedy (O'Reilly). For additional coverage of HTTP, see the HTTP Pocket Reference, by Clinton Wong (O'Reilly).